/* ASC 약관 본문 · 약관 상세 팝업
 *
 * ★ 직접 작성분이다(dialog.css 와 같은 이유). app.css 는 split-prototype.mjs 가
 *   원본 프로토타입에서 생성하므로 여기에 넣을 스타일을 그쪽에 두면 재생성 때 사라진다.
 *
 * 본문은 terms-content/*.html 에서 온다(build-jsp-views.mjs 의 termsContent).
 * 확정 문안은 문단(<p>)·표(<table>)로 되어 있어 .terms-box 의 white-space:pre-line 을
 * 그대로 두면 태그 사이 줄바꿈이 빈 줄로 보인다. .terms-doc 에서 normal 로 되돌린다.
 */

.terms-doc { white-space: normal; }

.terms-doc p { margin: 0 0 6px; }

.terms-doc h4 {
  margin: 14px 0 6px;
  color: var(--text);
  font-size: 11px;
}

/* 조(條) 제목 — "제1조 (목적)" */
.terms-doc .terms-article {
  margin-top: 10px;
  color: var(--text);
  font-weight: 700;
}

/* 호·목 — "1. …" "가. …" */
.terms-doc .terms-indent { padding-left: 10px; }

/* 수집 항목·보유 기간 표. 폰 폭에서 가로 스크롤이 생기지 않게 고정 배치 + 줄바꿈 */
.terms-table {
  width: 100%;
  margin: 6px 0 10px;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}

.terms-table th,
.terms-table td {
  padding: 6px;
  border: 1px solid var(--gray-3);
  text-align: left;
  vertical-align: top;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.terms-table th {
  background: var(--gray-0);
  color: var(--text);
  font-weight: 700;
}

/* 동의 행의 "상세보기" — 행 전체 클릭(동의 토글)과 구분되는 별도 버튼.
   .agree-row 가 3열 grid(체크 · 문구 · 오른쪽)라 세 번째 칸에 들어간다. */
.terms-detail-btn {
  padding: 4px 8px;
  border: 1px solid var(--gray-3);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
}

/* 약관 상세 팝업 — .asc-dialog(오류 팝업)의 폭·가운데 정렬만 바꾼다 */
.terms-dialog-panel {
  max-width: 340px;
  text-align: left;
  outline: none;
}

.terms-dialog-panel .terms-box { margin: 0; }

/* 본인확인 약관 뷰어 — 외부(KMCIS) 약관을 앱 화면 안에서 보여 준다.
   다른 약관 화면과 같은 구성(앱 헤더 + 약관 상자)이고, 가입 화면 위에 덮어 띄운다.
   .phone-screen 기준 절대배치. 앱 헤더(10)보다 위, 메뉴 시트(50)·토스트(60)보다 아래. */
.terms-viewer {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: none;
  flex-direction: column;
  background: #fff;
}

.terms-viewer.open { display: flex; }

/* 본문 여백은 약관 화면(.screen.no-bottom)과 같게 */
.terms-viewer-body {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 24px 24px 28px;
}

/* 약관 상자를 남은 높이만큼 채우고, 스크롤은 iframe 안에서 한다 */
.terms-viewer-box {
  flex: 1;
  display: flex;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  white-space: normal;
}

.terms-viewer-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  background: transparent;
}

/* 열 때 초점을 받는 자리(tabindex=-1)라 테두리를 그리지 않는다.
   뒤로가기 버튼에 초점을 주던 때는 모바일에서 버튼에 사각 테두리가 보였다. */
.terms-viewer:focus { outline: none; }

/* 터치·마우스로 생긴 초점에는 테두리를 그리지 않는다. 키보드 초점(:focus-visible)은 남긴다. */
.terms-viewer .back-btn:focus:not(:focus-visible) { outline: none; }

/* 알뜰폰일 때만 보이는 동의 행(hidden 속성).
   .agree-row 의 display:grid 가 브라우저 기본 [hidden]{display:none} 보다 우선해서,
   이 규칙이 없으면 hidden 을 걸어도 행이 그대로 보인다. */
.agree-row[hidden] { display: none; }
