/* ============================================================
   하단 사업자 정보(.legal-footer)와 정책·상품 안내 페이지(.legal-page)
   ------------------------------------------------------------
   로그인 전에도 열리는 공개 파일이다(shared/login_gate.py). 로그인 랜딩은 theme.css를
   읽지 않으므로 토큰마다 랜딩 색을 대체값으로 둔다 — 그래서 랜딩에서는 늘 밝은 종이색이다.
   하단 조각은 작게: 12px, 보조 글자색, 화면 구성을 밀지 않는다. modules/legal
   ============================================================ */

.legal-footer {
  display: block;               /* 랜딩의 footer{display:flex} 규칙을 이긴다 */
  box-sizing: border-box;
  width: min(1120px, calc(100% - 32px));
  margin: 40px auto 0;
  padding: 16px 0 calc(28px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--separator, #d5dbcd);
  font-family: var(--font, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif);
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: 0;
  color: var(--label-secondary, #6b7468);
  word-break: keep-all;
  text-align: left;
}
.legal-footer a { color: inherit; text-decoration: none; }
.legal-footer a:hover { text-decoration: underline; }
.legal-footer a:focus-visible { outline: var(--focus-ring, 3px solid #4a8759); outline-offset: 2px; border-radius: var(--r-control, 4px); }
.legal-footer__links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 6px; }
.legal-footer__links a { color: var(--label, #192820); min-height: 24px; display: inline-flex; align-items: center; }
.legal-footer__links strong { font-weight: 700; }
.legal-footer__links .legal-footer__leave { color: var(--label-secondary, #6b7468); text-decoration: underline; }
.legal-footer__biz { display: flex; flex-wrap: wrap; gap: 0 12px; margin: 0; }
.legal-footer__biz > * { white-space: nowrap; }
.legal-footer__biz > a { text-decoration: underline; }
.legal-footer__k { color: var(--label-tertiary, #8a9286); }
.legal-footer__copy { margin: 6px 0 0; color: var(--label-tertiary, #8a9286); }
/* 로그인 랜딩(스크롤 장면): 화면 전체에 고정된 장면 겹(.world, z-index 0) 위로 올리고 바탕을 칠한다 — 아니면 장면 그림에
   가려 보이지 않는다. 휴대폰에서는 화면 아래 고정된 카카오 로그인 버튼에 가리지 않게 그만큼 비운다. */
.legal-footer--landing {
  position: relative; z-index: 1;
  width: 100%; margin: 0;
  padding: 20px max(24px, calc((100% - 1120px) / 2)) calc(32px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-grouped, #ebe3d4);
}
@media (max-width: 700px) {
  .legal-footer { width: calc(100% - 32px); margin-top: 28px; }
  .legal-footer__biz > * { white-space: normal; }
}
/* 랜딩은 759px 아래에서 카카오 버튼이 화면 아래에 붙는다(static/landing/scenes.css). */
@media (max-width: 759px) {
  .legal-footer--landing { width: 100%; margin: 0; padding: 18px 18px calc(92px + env(safe-area-inset-bottom, 0px)); }
}
/* 로그인 랜딩: 펼쳐 두되 더 작고 옅게 — 장면 끝에 조용히 놓인다. */
.legal-footer--landing { font-size: 11px; line-height: 1.6; }
.legal-footer--landing .legal-footer__links a { color: var(--label-secondary, #6b7468); }
.legal-footer--landing .legal-footer__biz { color: var(--label-tertiary, #8a9286); }
/* 첫 화면: '사업자 정보'를 접어 둔다. */
.legal-footer__more { margin: 0; }
.legal-footer__more > summary {
  display: inline-flex; align-items: center; gap: 4px; min-height: 24px;
  list-style: none; cursor: pointer; color: var(--label-tertiary, #8a9286);
}
.legal-footer__more > summary::-webkit-details-marker { display: none; }
.legal-footer__more > summary::after { content: "▾"; font-size: 10px; }
.legal-footer__more[open] > summary::after { content: "▴"; }
.legal-footer__more > summary:focus-visible { outline: var(--focus-ring, 3px solid #4a8759); outline-offset: 2px; border-radius: var(--r-control, 4px); }
.legal-footer__more > .legal-footer__biz { margin-top: 2px; }
/* 시험·내 정보 화면: 정책 링크 한 줄만, 작게. */
.legal-footer--compact { margin-top: 24px; padding-top: 10px; border-top-color: transparent; font-size: 11px; }
.legal-footer--compact .legal-footer__links { margin: 0; gap: 2px 12px; }
.legal-footer--compact .legal-footer__links a { color: var(--label-tertiary, #8a9286); }
.legal-footer--compact .legal-footer__links strong { font-weight: 600; color: var(--label-secondary, #6b7468); }
@media print { .legal-footer { display: none; } }

/* ── 정책·상품 안내 페이지 ── */
.legal-page { font-size: 16px; line-height: 1.75; }
.legal-top, .legal-doc { width: min(760px, calc(100% - 32px)); margin: 0 auto; }
.legal-top { padding: 18px 0 0; }
.legal-brand {
  font-size: 13px; font-weight: 800; letter-spacing: .12em;
  color: var(--tint-readable, #2b3a8f); text-decoration: none;
}
.legal-doc {
  box-sizing: border-box;
  margin-top: 14px;
  padding: 24px;
  background: var(--bg-elevated, #fffdf9);
  border: 1px solid var(--separator, #d5dbcd);
  border-radius: var(--r-card, 16px);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.legal-doc h1, .legal-doc h2 { font-family: var(--font-heading, inherit); }
.legal-doc h1 { font-size: clamp(24px, 3.2vw, 30px); line-height: 1.3; letter-spacing: -0.03em; margin: 0 0 4px; }
.legal-doc h2 { font-size: 18px; line-height: 1.4; margin: 30px 0 8px; padding-top: 14px; border-top: 1px solid var(--separator, #d5dbcd); }
.legal-doc h3 { font-size: 16px; margin: 20px 0 6px; }
.legal-doc p, .legal-doc li { color: var(--label, #192820); }
.legal-doc p { margin: 8px 0; }
.legal-doc ul, .legal-doc ol { margin: 8px 0; padding-left: 1.3em; }
.legal-doc li + li { margin-top: 4px; }
.legal-doc a { color: var(--tint-readable, #2b3a8f); }
.legal-doc code { font-size: .9em; padding: 1px 5px; border-radius: var(--r-control, 4px); background: var(--fill-tertiary, rgba(118,118,128,.12)); }
.legal-doc blockquote { margin: 10px 0; padding: 4px 14px; border-left: 3px solid var(--separator, #d5dbcd); color: var(--label-secondary, #6b7468); }
.legal-meta { color: var(--label-secondary, #6b7468) !important; font-size: 13px; margin: 0 0 12px !important; }
.legal-lead { font-size: 17px; }
.legal-draft {
  margin: 0 0 16px !important; padding: 10px 14px; border-radius: var(--r-group, 12px);
  background: var(--highlight-soft, rgba(200,135,27,.16)); color: var(--highlight-strong, #8a5410) !important;
  font-size: 14px; font-weight: 600;
}
mark.legal-todo {
  display: inline; padding: 1px 6px; border-radius: var(--r-control, 4px);
  background: var(--highlight-soft, rgba(200,135,27,.16)); color: var(--highlight-strong, #8a5410);
  font-size: 13px; font-weight: 700;
}
mark.legal-todo[data-kind="법률 검토 필요"] { background: color-mix(in srgb, var(--sys-purple, #af52de) 14%, transparent); color: var(--label, #192820); }
.legal-table { overflow-x: auto; margin: 10px 0; border: 1px solid var(--separator, #d5dbcd); border-radius: var(--r-group, 12px); }
.legal-table table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.55; }
.legal-table th, .legal-table td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--separator, #d5dbcd); }
.legal-table tr:last-child td { border-bottom: 0; }
.legal-table th { background: var(--fill-quaternary, rgba(116,116,128,.08)); font-weight: 700; white-space: nowrap; }
.legal-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.legal-facts { margin: 10px 0; display: grid; gap: 0; border: 1px solid var(--separator, #d5dbcd); border-radius: var(--r-group, 12px); overflow: hidden; }
.legal-facts > div { display: grid; grid-template-columns: 9.5em 1fr; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--separator, #d5dbcd); font-size: 14px; }
.legal-facts > div:last-child { border-bottom: 0; }
.legal-facts dt { color: var(--label-secondary, #6b7468); font-weight: 600; }
.legal-facts dd { margin: 0; }
.pricing-status {
  padding: 10px 14px; border-radius: var(--r-group, 12px); font-size: 14px; font-weight: 600;
  background: var(--fill-tertiary, rgba(118,118,128,.12)); color: var(--label, #192820) !important;
}
.pricing-status.is-open { background: color-mix(in srgb, var(--ok, #157040) 14%, transparent); }
@media (max-width: 700px) {
  .legal-page { font-size: 15px; }
  .legal-doc { padding: 16px; margin-top: 10px; }
  .legal-facts > div { grid-template-columns: 1fr; gap: 2px; }
  .legal-table th, .legal-table td { padding: 7px 9px; }
}

/* ── 이용 동의(/legal/consent)·회원 탈퇴(/me/withdraw) ── */
.consent { margin: 16px 0 0; display: grid; gap: 10px; }
.consent label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; min-height: 44px; padding: 10px 0; }
.consent input[type="checkbox"] { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--tint, #2b3a8f); }
.consent-all { font-weight: 700; border-bottom: 1px solid var(--separator, #d5dbcd); }
.consent-item { border-bottom: 1px solid var(--separator, #d5dbcd); padding-bottom: 6px; }
.consent-item label b { color: var(--tint-readable, #2b3a8f); }
.consent-note { margin: 0 0 6px 30px !important; font-size: 13px; color: var(--label-secondary, #6b7468) !important; }
.consent-detail { margin: 0 0 6px 30px; font-size: 13px; }
.consent-detail p, .consent-detail li { font-size: 13px; }
.consent-error { margin: 0 !important; color: var(--sys-red, #ff3b30) !important; font-size: 14px; font-weight: 600; }
.consent-submit {
  min-height: 48px; border: 0; border-radius: var(--r-control, 10px);
  background: var(--tint, #2b3a8f); color: var(--tint-ink, #fff); font: inherit; font-weight: 700; font-size: 16px; cursor: pointer;
}
.consent-submit:disabled { opacity: .45; cursor: default; }
.consent-submit.is-danger { background: var(--sys-red, #ff3b30); color: #fff; }
.consent-leave { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; font-size: 14px; }
.consent-leave button, .consent-leave a {
  min-height: 44px; display: inline-flex; align-items: center; background: none; border: 0; padding: 0;
  font: inherit; color: var(--label-secondary, #6b7468); text-decoration: underline; cursor: pointer;
}
@media (max-width: 700px) {
  .consent-note, .consent-detail { margin-left: 0 !important; }
}

/* 결제 직전 고지(config/payments.json) — 환불정책·상품 안내가 결제 화면과 같은 문장을 보여 준다. */
.legal-notice { margin: 10px 0; padding: 4px 14px; border: 1px solid var(--separator, #d5dbcd); border-radius: var(--r-group, 12px); background: var(--fill-quaternary, rgba(116,116,128,.08)); }
.legal-notice ul { margin: 8px 0; }
.legal-notice li { font-size: 14px; }
.legal-notice-check { font-size: 14px; font-weight: 600; margin: 6px 0 10px !important; }

/* 로그인된 기기(/auth/devices 로그인 대기, /me/devices) — shared/device_pages.py. theme.css 토큰만 쓴다. */
.device-list { list-style: none; margin: 12px 0; padding: 0; border: 1px solid var(--separator); border-radius: var(--r-group); overflow: hidden; }
.legal-doc .device-list { padding-left: 0; }
.device-row { margin: 0 !important; border-bottom: 1px solid var(--separator); }
.device-row:last-child { border-bottom: 0; }
.device-row > label, .device-row > .device-main:only-child { display: flex; gap: 12px; align-items: center; min-height: 56px; padding: 8px 14px; box-sizing: border-box; }
.device-row > label { cursor: pointer; }
.device-row > label:has(input:checked) { background: var(--fill-quaternary); }
.device-row input[type="radio"] { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--tint); }
.device-row.is-current { display: flex; gap: 12px; align-items: center; justify-content: space-between; min-height: 56px; padding: 8px 14px; }
.device-main { display: grid; gap: 2px; min-width: 0; }
.device-name { font-weight: 700; color: var(--label); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.device-meta { font-size: 13px; color: var(--label-secondary); }
.device-badge { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill); background: var(--fill-tertiary); color: var(--label-secondary); }
.device-logout { margin: 0; flex: none; }
.device-link { min-height: 44px; padding: 0 4px; background: none; border: 0; font: inherit; font-size: 14px; color: var(--tint-readable); text-decoration: underline; cursor: pointer; }
.device-form { display: grid; gap: 12px; margin: 0 0 8px; }
.device-note { font-size: 14px; color: var(--label-secondary) !important; }
.device-notice { margin: 0 0 12px !important; padding: 10px 14px; border-radius: var(--r-group); background: var(--ok-bg); color: var(--label) !important; font-size: 14px; }
.device-callout { padding: 10px 14px; border-radius: var(--r-group); background: var(--warn-bg); color: var(--label) !important; }
.device-row :focus-visible, .device-link:focus-visible { outline: 3px solid var(--tint); outline-offset: 2px; }
.consent-submit.is-quiet { background: var(--fill-tertiary); color: var(--label); }

/* 아이디 로그인(/auth/login/id, 운영자가 발급한 계정만) — theme.css 토큰만 쓴다. */
.id-login-form { max-width: 420px; gap: 6px; }
.id-login-form label { min-height: 0; padding: 8px 0 0; font-weight: 600; cursor: default; }
.id-login-form input[type="text"], .id-login-form input[type="password"] {
  min-height: 48px; padding: 0 12px; border: 1px solid var(--separator, #d5dbcd); border-radius: var(--r-control, 10px);
  background: var(--bg-elevated, #fff); color: var(--label, #192820); font: inherit; font-size: 16px; }
.id-login-form input:focus-visible { outline: 3px solid var(--tint, #2b3a8f); outline-offset: 1px; }
.id-login-form .consent-submit { margin-top: 12px; }
