/* 看圖美化：me（_build/polish.py） */
body .c-demo-banner {
  position: relative;
  top: auto;
  gap: var(--sp-3);
  margin: 0 0 var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border: 0;
  border-radius: var(--r-input);
  text-align: left;
}

body .c-demo-banner > svg {
  flex: none;
}

body .c-demo-banner > :not(.c-btn):not(svg) {
  flex: 1 1 0;
  min-width: 0;
  text-wrap: balance;
}

body .c-demo-banner .c-btn {
  flex: none;
  margin-left: auto;
  padding: 0 var(--sp-4);
  white-space: nowrap;
}

/* ==========================================================================
   「我的」版面：手機單欄、平板與桌面雙欄，依任務重排
   ========================================================================== */
body .s-me .s-more-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "treat"
    "care"
    "links"
    "privacy"
    "caps"
    "pro";
  align-items: stretch;
  gap: var(--sp-4);
}

body .s-me .s-more-grid > :nth-child(1) { grid-area: privacy; }
body .s-me .s-more-grid > :nth-child(2) { grid-area: pro; }
body .s-me .s-more-grid > :nth-child(3) { grid-area: treat; }
body .s-me .s-more-grid > :nth-child(4) { grid-area: care; }
body .s-me .s-more-grid > :nth-child(5) { grid-area: caps; }
body .s-me .s-more-grid > :nth-child(6) { grid-area: links; }

@media (min-width: 600px) {
  body .s-me .s-more-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "treat care"
      "links links"
      "privacy caps"
      "pro pro";
    gap: var(--sp-5);
  }
}

@media (min-width: 1024px) {
  body .s-me .s-more-grid {
    gap: var(--sp-6);
  }

  body .s-me .c-card {
    padding: var(--sp-6);
  }
}

body .s-me .c-card__head {
  margin-bottom: var(--sp-4);
}

/* ---------- 隱私卡 ---------- */
body .s-me .c-privacy-line {
  flex-direction: row;
  align-items: flex-start;
  gap: var(--sp-2);
  margin: 0;
  padding: var(--sp-3) var(--sp-4);
  color: var(--text-2);
  font-size: var(--fs-callout);
  line-height: 1.55;
}

body .s-me .c-privacy-line > svg {
  flex: none;
  margin-top: 3px;
  color: var(--primary);
}

body .s-me .s-me__details {
  padding: 0;
  border-top: 1px solid var(--divider);
  border-radius: 0;
  background: transparent;
}

body .s-me .s-me__details > summary {
  min-height: 48px;
  padding: 0 var(--sp-1);
}

body .s-me .s-me__details[open] {
  padding-bottom: var(--sp-2);
}

body .s-me .c-privacy-notes {
  padding: 0 var(--sp-1) var(--sp-2) calc(var(--sp-5) + var(--sp-1));
}

body .s-me .s-me__details ~ .s-me__row,
body .s-me .c-privacy-line ~ .s-me__row {
  margin-top: 0;
}

body .s-me .s-me__row > .u-text-3 {
  white-space: nowrap;
}

/* ---------- 療程狀態：分段控制改為依文字長度分配寬度 ---------- */
body .s-me .c-seg {
  display: flex;
  width: 100%;
  gap: 2px;
}

body .s-me .c-seg__thumb {
  display: none;
}

body .s-me .c-seg__opt {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-callout);
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}

body .s-me .c-seg__opt[aria-checked="true"],
body .s-me .c-seg__opt[aria-selected="true"],
body .s-me .c-seg__opt.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}

body .s-me .s-me__status-note {
  margin-top: 0;
  font-size: var(--fs-callout);
}

/* ---------- 醫療團隊：內層卡片降一階，避免卡中卡與重複標題 ---------- */
body .s-me .c-card .c-card {
  padding: var(--sp-4);
  border: 0;
  border-radius: var(--r-input);
  background: var(--surface-2);
  box-shadow: none;
}

body .s-me .c-card .c-card > .c-card__head {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- 按鈕一致性 ---------- */
body .s-me .c-btn--block {
  min-height: 48px;
}

body .s-me .c-btn--ghost {
  align-self: flex-start;
  justify-content: flex-start;
  min-height: 44px;
  padding-inline: 0;
}

body .s-me .c-btn--ghost.c-btn--block {
  justify-content: center;
}

/* ---------- Pro 卡：獨立強調，桌面橫向排列 ---------- */
body .s-me .s-more-grid > :nth-child(2) {
  border-color: var(--primary-soft);
  background: var(--primary-tint);
  box-shadow: none;
}

body .s-me .s-more-grid > :nth-child(2) .c-card__title {
  color: var(--primary-strong);
}

body .s-me .s-more-grid > :nth-child(2) .c-btn--secondary {
  --btn-bg: var(--primary);
  --btn-fg: var(--text-on-primary);
}

body .s-me .s-more-grid > :nth-child(2) p {
  margin: 0;
}

@media (hover: hover) and (pointer: fine) {
  body .s-me .s-more-grid > :nth-child(2) .c-btn--secondary:hover {
    background: var(--primary-strong);
    filter: none;
  }
}

@media (min-width: 600px) {
  body .s-me .s-more-grid > :nth-child(2) .c-card__body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-3) var(--sp-6);
  }

  body .s-me .s-more-grid > :nth-child(2) .c-card__body > * + * {
    margin-top: 0;
  }

  body .s-me .s-more-grid > :nth-child(2) .c-card__body > p {
    flex: 1 1 260px;
  }

  body .s-me .s-more-grid > :nth-child(2) .c-card__body > .c-btn {
    flex: 0 1 auto;
    width: auto;
    min-width: 200px;
  }
}

/* ---------- 功能清單：平板以上分兩欄 ---------- */
body .s-me .s-me__list {
  display: flex;
  flex-direction: column;
}

@media (min-width: 600px) {
  body .s-me .s-me__list {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(5, auto);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--sp-8);
  }

  body .s-me .s-me__list .s-me__row:nth-child(1),
  body .s-me .s-me__list .s-me__row:nth-child(6) {
    border-top: 0;
  }
}

/* ---------- 裝置能力 ---------- */
body .s-me .s-more-grid > :nth-child(5) .u-text-2 {
  font-size: var(--fs-callout);
  line-height: 1.6;
  text-wrap: balance;
}

body .s-me .s-me__cap:first-child {
  border-top: 0;
}

body .s-me .s-me__caps {
  padding-bottom: var(--sp-2);
}

body .s-me .u-footnote {
  margin: 0;
  text-wrap: pretty;
}
