/* x-md.css — 마이페이지·구독 결제(md) 전용. 접두어 .md- */

/* 공통 틀: 본문 + 오른쪽 사이드 */
.md-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.md-side { position: sticky; top: calc(var(--header-h) + 16px); }
aside.md-side.stack-24 { position: static; }
@media (max-width: 980px) { .md-grid { grid-template-columns: minmax(0, 1fr); } .md-side { position: static; } }
.md-h { font-size: var(--fs-lg); display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.md-page .card h2 { font-size: var(--fs-lg); }

/* 프로필 */
.md-profile { display: flex; align-items: center; gap: 18px; }
.md-avatar { width: 64px; height: 64px; border-radius: var(--r-pill); display: grid; place-items: center; flex: 0 0 auto; background: var(--accent-soft); color: var(--accent-ink); font: 700 26px var(--font-body); }
.md-name { font-size: var(--fs-h3); line-height: 1.3; }
.md-mail { overflow-wrap: anywhere; }
.md-profile p .ic { color: var(--ink-3); }
@media (max-width: 600px) {
  .md-profile { flex-wrap: wrap; gap: 14px; }
  .md-avatar { width: 52px; height: 52px; font-size: 22px; }
  .md-profile-badge { width: 100%; }
}

/* 구독 상태 */
.md-plan { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r); }
.md-plan-name { font-size: var(--fs-lg); font-weight: 700; }
.md-kv { grid-template-columns: 110px 1fr; }
.md-sub-actions form { display: contents; }

/* 이번 달 사용량 */
.md-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.md-stats .stat .v small { margin-left: 2px; color: var(--ink-3); font-family: var(--font-body); font-weight: 500; }
.md-stat-link { transition: border-color var(--t-short) var(--ease), box-shadow var(--t-short) var(--ease); }
.md-stat-link:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
@media (max-width: 600px) {
  .md-stats { gap: 8px; }
  .md-stats .stat { padding: 14px 12px; }
  .md-stats .stat .v { font-size: 22px; }
  .md-stats .stat .k { font-size: var(--fs-xs); }
}

/* 결제 내역 */
.md-pays { display: flex; flex-direction: column; }
.md-pay { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.md-pay:first-child { border-top: 0; padding-top: 4px; }
.md-pay-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.md-pay-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.md-pay-amt { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; flex: 0 0 auto; }
.md-pay-amt strong { font-size: var(--fs-md); }
.md-strike { color: var(--ink-3); text-decoration: line-through; }
.md-refund { color: var(--danger); font-weight: 700; }
.md-fail { color: var(--danger); display: flex; align-items: center; gap: 4px; }

/* 설정 링크 · 로그아웃 */
.md-links { padding: 6px; display: flex; flex-direction: column; }
.md-links a { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-sm); font-weight: 500; min-height: 52px; }
.md-links a:hover { background: var(--surface-3); }
.md-links a > .ic { color: var(--ink-3); }
.md-links .ico-box { width: 34px; height: 34px; border-radius: 10px; }
.md-logout { width: 100%; }

/* 구독 해지: 마이페이지 위에 시트 */
.md-behind { pointer-events: none; user-select: none; }
.md-overlay { position: fixed; inset: 0; z-index: 80; overflow-y: auto; background: color-mix(in srgb, var(--ink) 48%, transparent); }
.md-overlay .sheet-page { min-height: 100%; background: transparent; padding-top: 48px; padding-bottom: 48px; }
.md-overlay .sheet { width: min(520px, 100%); }
.md-reasons { border: 0; padding: 0; margin: 0; min-width: 0; }
.md-reasons legend { margin-bottom: 4px; }
.md-reasons .radio { padding: 8px 0; min-height: 40px; }
@media (max-width: 600px) { .md-overlay .sheet-page { padding-top: 16px; padding-bottom: 16px; } }

/* 구독 결제: 요금제 카드 */
.md-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.md-plan-opt { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 22px; background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--r-lg); cursor: pointer; transition: border-color var(--t-short) var(--ease), box-shadow var(--t-short) var(--ease); }
.md-plan-opt:hover { border-color: var(--ink-3); }
.md-plan-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.md-plan-opt:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.md-plan-opt:has(input:focus-visible) { box-shadow: var(--focus); }
.md-plan-opt.is-off { cursor: default; background: var(--surface-3); }
.md-plan-opt.is-off:hover { border-color: var(--line-strong); }
.md-plan-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.md-plan-title { font-size: var(--fs-lg); font-weight: 700; }
.md-price { display: flex; align-items: baseline; gap: 4px; }
.md-price strong { font-size: 34px; line-height: 1.1; }
.md-feat { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: var(--fs-sm); }
.md-feat li { display: flex; gap: 8px; align-items: flex-start; }
.md-feat .ic { color: var(--pos); margin-top: 3px; }
.md-plan-pick { display: none; align-items: center; gap: 4px; margin-top: 4px; font-size: var(--fs-sm); font-weight: 700; color: var(--accent); }
.md-plan-opt:has(input:checked) .md-plan-pick { display: inline-flex; }
.md-trial { display: flex; gap: 14px; align-items: flex-start; }
.md-card-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 600px) { .md-card-row { grid-template-columns: minmax(0, 1fr); } .md-plan-opt { padding: 18px; } }
.md-fail-check { padding: 12px 14px; background: var(--surface-3); border: 1px dashed var(--line-strong); border-radius: var(--r-sm); }

/* 결제 요약: 고른 요금제만 보이게 */
.md-sum { display: none; column-gap: 0; }
.md-sum dt { padding-right: 16px; }
.md-sum dt, .md-sum dd { font-size: var(--fs-sm); }
.md-sum .md-sum-total { padding-top: 10px; border-top: 1px solid var(--line); }
.md-sum dd.md-sum-total { text-align: right; }
.md-sum dd.md-sum-total strong { font-size: var(--fs-h4); color: var(--accent-ink); }
.md-sum dd { text-align: right; }
.md-sum dt.md-sum-total { color: var(--ink); font-weight: 700; }
.md-pay-form:not(:has(input[name="plan"]:checked)) .md-sum:first-of-type { display: grid; }
.md-pay-btn { width: 100%; }
.md-demo { display: flex; gap: 6px; align-items: flex-start; }
.md-summary > .btn-ghost { align-self: center; }

/* 결제 완료 */
.md-done { text-align: center; }
.md-done-ico { width: 64px; height: 64px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: var(--r-pill); background: var(--ok-soft); color: var(--ok); }
.md-done-ico .ic { width: 30px; height: 30px; }
.md-done h1 { font-size: var(--fs-h3); }
.md-done p { margin-top: 6px; }
.md-done-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .md-done-grid { grid-template-columns: minmax(0, 1fr); } }
.md-open { display: flex; flex-direction: column; gap: 12px; }
.md-open li { display: flex; gap: 12px; align-items: flex-start; }
.md-done-actions .btn { min-width: 180px; }
@media (max-width: 600px) { .md-done-actions .btn { flex: 1 1 100%; } }
html:has(.md-overlay), body:has(.md-overlay) { overflow: hidden; height: 100%; }
