/* =====================================================================
   내 정보 탭 · 설정 및 개인정보 (토스 스타일: 섹션 제목 + 둥근 카드 안 행 목록)
   - 색 아이콘 톤(.mi-c-*)과 계정 메뉴·서랍 스타일은 tds-style.css 맨 아래에 있다 (다른 페이지의 헤더 메뉴도 쓰므로)
   - PC(가운데 열)와 모바일이 같은 컴포넌트를 쓰고, 다크 모드는 html.dark 로 바뀐다
   ===================================================================== */
.mi {
  --mi-card: #FFFFFF; --mi-line: #F2F4F6; --mi-text: #191F28; --mi-sub: #8B95A1; --mi-press: #F4F5F7; --mi-title: #6B7684;
  width: 100%; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column;
  padding-bottom: 8px; color: var(--mi-text);
}
html.dark .mi { --mi-card: #1E2025; --mi-line: #2A2D33; --mi-text: #F2F4F6; --mi-sub: #8B95A1; --mi-press: #292C33; --mi-title: #A6B0BC; }

.mi.hidden, .mi-badge.hidden { display: none !important; }
.mi-card { background: var(--mi-card); border-radius: 20px; overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03); }
html.dark .mi-card { box-shadow: none; border: 1px solid #2A2D33; }
.mi-group { margin-top: 22px; }
.mi-group:first-child { margin-top: 0; }
.mi-title { padding: 0 8px 10px; font-size: 14px; font-weight: 700; line-height: 1.4; color: var(--mi-title); }

/* 행: 56px 안팎, 원형 아이콘 + 이름(+설명) + 값/화살표 */
.mi-row {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 10px 16px;
  background: transparent; color: var(--mi-text); text-align: left; text-decoration: none; cursor: pointer;
  transition: background .15s ease, transform .12s ease; -webkit-tap-highlight-color: transparent;
}
.mi-row + .mi-row::before { content: ''; position: absolute; top: 0; left: 66px; right: 16px; height: 1px; background: var(--mi-line); }
.mi-row:hover { background: var(--mi-press); }
.mi-row:active { background: var(--mi-press); transform: scale(.992); }
.mi-row:focus-visible { outline: 2px solid #3182F6; outline-offset: -2px; }
.mi-row-static { cursor: default; }
.mi-row-static:hover, .mi-row-static:active { background: transparent; transform: none; }
.mi-ico { width: 38px; height: 38px; font-size: 18px; }
.mi-label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 15.5px; font-weight: 600; line-height: 1.35; }
.mi-label small { font-size: 12.5px; font-weight: 400; line-height: 1.4; color: var(--mi-sub); }
.mi-value { flex: 0 0 auto; font-size: 13.5px; font-weight: 600; color: var(--mi-sub); }
.mi-chev { flex: 0 0 auto; width: 18px; height: 18px; color: #B0B8C1; transition: transform .15s ease; }
.mi-row:hover .mi-chev { transform: translateX(2px); }
.mi-row-danger .mi-label { color: #F04452; }
html.dark .mi-row-danger .mi-label { color: #FF6B76; }
.mi-badge { flex: 0 0 auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: #F04452; color: #FFF; font-size: 12px; font-weight: 800; line-height: 22px; text-align: center; }
.mi-badge.hidden { display: none; }

/* 스위치 (설정 안 켜고 끄는 행) */
.mi-switch { position: relative; flex: 0 0 auto; width: 46px; height: 28px; border-radius: 999px; background: #D1D6DB; transition: background .2s ease; }
.mi-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #FFF; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); transition: transform .2s ease; }
.mi-switch.is-on { background: #3182F6; }
.mi-switch.is-on::after { transform: translateX(18px); }
html.dark .mi-switch { background: #50535A; }
html.dark .mi-switch.is-on { background: #3182F6; }

/* 글자 크기 같은 분할 선택 */
.mi-seg { flex: 0 0 auto; display: inline-flex; padding: 3px; border-radius: 12px; background: #F2F4F6; }
.mi-seg button { min-width: 48px; height: 32px; padding: 0 10px; border-radius: 9px; font-size: 13px; font-weight: 700; color: #6B7684; transition: background .15s, color .15s; }
.mi-seg button.is-active { background: #FFF; color: #191F28; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
html.dark .mi-seg { background: #2F3236; }
html.dark .mi-seg button { color: #A6B0BC; }
html.dark .mi-seg button.is-active { background: #4A4E56; color: #FFF; box-shadow: none; }

/* 프로필 카드 */
.mi-profile { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.mi-profile-main { display: flex; align-items: center; gap: 14px; width: 100%; padding: 2px 0; text-align: left; border-radius: 14px; transition: opacity .15s, transform .12s; }
.mi-profile-main:active { transform: scale(.99); opacity: .85; }
.mi-avatar { flex: 0 0 auto; width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; }
.mi-avatar > * { width: 56px !important; height: 56px !important; font-size: 22px !important; }
.mi-profile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mi-nick { font-size: 19px; font-weight: 800; line-height: 1.3; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-points { font-size: 14px; font-weight: 600; color: var(--mi-sub); }
.mi-points b { color: #3182F6; font-weight: 800; }
html.dark .mi-points b { color: #61B0FF; }
.mi-profile-edit { width: 100%; height: 44px; border-radius: 12px; background: #F2F4F6; color: #4E5968; font-size: 14px; font-weight: 700; transition: background .15s, transform .12s; }
.mi-profile-edit:hover { background: #E8EBED; }
.mi-profile-edit:active { transform: scale(.985); }
html.dark .mi-profile-edit { background: #2F3236; color: #D1D6DB; }
html.dark .mi-profile-edit:hover { background: #3A3D42; }
.mi-guest { align-items: stretch; padding: 22px 16px 16px; }
.mi-guest-text { font-size: 15px; font-weight: 600; line-height: 1.5; text-align: center; }
.mi-guest-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mi-btn { height: 46px; border-radius: 12px; background: #F2F4F6; color: #4E5968; font-size: 15px; font-weight: 700; transition: background .15s, transform .12s; }
.mi-btn:active { transform: scale(.985); }
.mi-btn-primary { background: #3182F6; color: #FFF; }
.mi-btn-primary:hover { background: #2272EB; }
html.dark .mi-btn { background: #2F3236; color: #D1D6DB; }
html.dark .mi-btn-primary { background: #3182F6; color: #FFF; }
.mi-profile.hidden, .mi-group.hidden { display: none; }
/* 로그인 전에는 프로필 카드 대신 로그인 안내만 보인다 */
#my-overview-view:has(#my-auth-box-logged-out:not(.hidden)) .mi-auth-only { display: none; }
.mi-auth-only { display: block; }
.mi-auth-only > .mi-group:first-child { margin-top: 22px; }
.mi-profile + .mi-auth-only > .mi-group:first-child { margin-top: 22px; }

/* 포인트 내역 · 포인트 선물 위쪽 탭 */
.mi-tabs { display: flex; gap: 4px; padding: 4px; margin: 4px 12px 14px; border-radius: 14px; background: #E8EBED; }
.mi-tabs button { flex: 1; height: 40px; border-radius: 10px; font-size: 14px; font-weight: 700; color: #6B7684; transition: background .15s, color .15s, transform .12s; }
.mi-tabs button:active { transform: scale(.98); }
.mi-tabs button.is-active { background: #FFF; color: #191F28; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
html.dark .mi-tabs { background: #25272A; }
html.dark .mi-tabs button { color: #A6B0BC; }
html.dark .mi-tabs button.is-active { background: #3A3D42; color: #FFF; box-shadow: none; }

/* ---------- 마이 상세 화면 공통 머리(뒤로가기 + 제목): 설정 계열은 카드형 목록과 어울리게 배경 없이 ---------- */
#my-detail-view:has(.settings-detail:not(.hidden)), #my-detail-view:has(#view-settings:not(.hidden)) { background: transparent; border-radius: 0; }
#my-detail-view:has(.settings-detail:not(.hidden)) > div:first-child, #my-detail-view:has(#view-settings:not(.hidden)) > div:first-child {
  background: transparent; border-bottom: 0; min-height: 56px; padding: 8px 4px;
}
html.dark #my-detail-view:has(.settings-detail:not(.hidden)) > div:first-child, html.dark #my-detail-view:has(#view-settings:not(.hidden)) > div:first-child { background: transparent; border-bottom: 0; }
#my-detail-view:has(#view-settings:not(.hidden)) > #my-detail-panels, #my-detail-view:has(.settings-detail:not(.hidden)) > #my-detail-panels { padding: 0 0 8px; }
#my-detail-panels > #view-settings > .mi, #my-detail-panels > #view-settings { min-height: 0; }
#my-detail-panels > #view-settings > .mi { border-radius: 0; }

/* 설정 하위 화면(알림 설정·푸시·개인정보 등): 같은 둥근 카드 */
#my-detail-view .settings-detail > .settings-hub { padding: 0; }
#my-detail-view .settings-detail .settings-hub-group { background: #FFF; border: 0; border-radius: 20px; margin-top: 16px; padding: 8px 0; overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03); }
#my-detail-view .settings-detail .settings-hub-group:first-child { margin-top: 4px; }
#my-detail-view .settings-detail .settings-hub-group > h3 { padding: 10px 16px 4px; font-size: 13px; font-weight: 700; color: #6B7684; letter-spacing: 0; text-transform: none; }
#my-detail-view .settings-detail .settings-hub-row { min-height: 60px; transition: background .15s; }
#my-detail-view .settings-detail .settings-detail-surface { border-radius: 20px !important; margin-top: 16px !important; background: #FFF; border: 0 !important; }
#my-detail-view .settings-detail .settings-detail-surface:first-child { margin-top: 4px !important; }
html.dark #my-detail-view .settings-detail .settings-hub-group, html.dark #my-detail-view .settings-detail .settings-detail-surface { background: #1E2025; border: 1px solid #2A2D33 !important; box-shadow: none; }

@media (max-width: 639px) {
  .mi-card { border-radius: 18px; }
  .mi-row { min-height: 58px; padding-left: 14px; padding-right: 14px; gap: 12px; }
  .mi-row + .mi-row::before { left: 62px; right: 14px; }
  .mi-ico { width: 36px; height: 36px; font-size: 17px; }
  .mi-label { font-size: 15px; }
  .mi-seg button { min-width: 42px; padding: 0 8px; }
  #my-detail-view { margin-left: 0; margin-right: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mi-row, .mi-chev, .mi-switch, .mi-switch::after, .mi-profile-main, .mi-btn, .mi-profile-edit, .mi-tabs button, .mi-seg button { transition: none; }
}

/* 설정 하위 화면: 바깥을 한 번 더 감싸던 큰 배경 상자를 없애고, 안쪽 그룹 카드만 보이게 한다(카드 뒤에 또 카드가 있어 이중으로 보이던 문제) */
#my-detail-view .settings-detail > .settings-hub,
#my-detail-panels > #view-settings > .settings-hub { background: transparent !important; border: 0 !important; box-shadow: none !important; border-radius: 0 !important; min-height: 0 !important; padding: 0 !important; }
#my-detail-panels > div.settings-detail:not(.hidden) > div:first-child { min-height: 0 !important; border-radius: 0; }
#my-detail-view .settings-detail,
#my-detail-panels > .settings-detail { background: transparent !important; border: 0 !important; box-shadow: none !important; border-radius: 0 !important; }
html.dark #my-detail-view .settings-detail, html.dark #my-detail-panels > .settings-detail { background: transparent !important; border: 0 !important; }

/* ---------- 통합 '설정 및 개인정보' 화면: 제목 + 프로필 + 활동·포인트 + 설정 5그룹이 한 화면에 이어진다 ---------- */
.mi-page-title { padding: 6px 8px 14px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.3; color: var(--mi-text); }
.mi-settings { display: block; }
.mi-settings > .mi-group:first-child { margin-top: 22px; }
.mi-auth-only { padding-bottom: 16px; }
#my-overview-view:has(#my-auth-box-logged-out:not(.hidden)) .mi-page-title { display: none; }
@media (max-width: 639px) { .mi-page-title { font-size: 20px; padding-bottom: 12px; } }
