/* 도씨 로그인·회원가입·비밀번호 찾기·PIN·QR 설치 — 원본 키트 "Login Page design (Community)"
   (Figma glra0jd6FcKhl7jMBz4lwb, 프레임 1:2 "Dashboard Login": 배경 1:3 / 입력칸 1:9·1:15 / 로그인 단추 1:21 / 비밀번호 찾기 1:24).
   파란 바탕(#2148C0) 위 흰 테두리 입력칸, 흰 단추. 밝은/어두운 테마 없이 이 화면 하나만 쓴다.
   원본과 다르게 한 것: 장바구니 그림 자리에 도씨 로고를 크게 둔다, Montserrat 대신 Pretendard,
   폭 300 → 360(한글 이메일이 잘리지 않게), 칸 높이 45 → 48(손가락 터치). 이름표는 낭독기용으로만 두고 자리표시 글자로 뜻을 알린다. */
.auth-page {
  color-scheme: dark;
  --bg: #2148c0;
  --ink-high: #fff;
  --ink: rgba(255, 255, 255, .92);
  --ink-mid: rgba(255, 255, 255, .82);
  --ink-low: rgba(255, 255, 255, .7);
  --link: #fff;
  --field-line: #fff;
  --field-focus: rgba(255, 255, 255, .3);
  --action: #fff;
  --soft: rgba(255, 255, 255, .14);
  --soft-ink: #fff;
  --hover: rgba(255, 255, 255, .12);
  --error-bg: #fef3f2;
  --error-fg: #b42318;
  --success-bg: #ecfdf3;
  --success-fg: #067647;
}

* { box-sizing: border-box; }

html:has(.auth-page), body.auth-page {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  overscroll-behavior-y: none;
}
body.auth-page {
  font-family: var(--font);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.auth {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 48px 20px;
}
/* 배경 1:3 — 1280×720 원본 배치를 한 장으로, 화면을 덮게 자른다 */
.auth-art {
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

.auth-panel {
  width: 360px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 56px;
}
.auth-panel > :not(.auth-logo), .auth-panel > a { width: 100%; }
.auth-panel > a { display: flex; justify-content: center; }
/* 장바구니 그림 자리(약 124×97) — 로고는 크게 */
.auth-logo { display: block; height: 96px; width: auto; }

.auth-body { display: flex; flex-direction: column; gap: 20px; }
/* 누가 봐도 알 수 있는 제목·이름표는 화면에 쓰지 않는다. 낭독기용으로만 남긴다 */
.sr-only,
.auth-field > label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.auth-desc { margin: 0; text-align: center; font-size: 16px; line-height: 1.6; font-weight: 500; color: var(--ink-high); word-break: keep-all; }

.auth-fields { display: flex; flex-direction: column; gap: 20px; }
.auth-field { display: flex; flex-direction: column; gap: 8px; }

/* 입력칸 1:10 — 흰 테두리, 왼쪽 흰 아이콘 20px */
.auth-input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 49px;
  border: 1px solid var(--field-line);
  border-radius: 4px;
  background: transparent url('/icons/login-user.svg') no-repeat 12px center / 20px 20px;
  color: #fff;
  font: 300 14px/20px var(--font);
}
.auth-input::placeholder { color: #fff; opacity: 1; }
.auth-input:focus { outline: none; box-shadow: 0 0 0 3px var(--field-focus); }
.auth-input[autocomplete$="password"] { background-image: url('/icons/login-lock.svg'); }
.auth-input[autocomplete="organization"] { background-image: url('/icons/login-building.svg'); }
.auth-input[type="tel"] { background-image: url('/icons/login-phone.svg'); }
.auth-input[autocomplete="one-time-code"] { background-image: url('/icons/login-passcode.svg'); }
.auth-input[name="vfcCode"] { background-image: url('/icons/login-key.svg'); }
/* 자동완성이 칸을 노랗게 칠하지 않게 */
.auth-input:-webkit-autofill { -webkit-text-fill-color: #fff; -webkit-box-shadow: 0 0 0 40px var(--bg) inset; caret-color: #fff; }

.auth-input-wrap { position: relative; }
.auth-input-wrap .auth-input { padding-right: 48px; }
.auth-eye {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 36px;
  height: 36px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-low);
  cursor: pointer;
}
.auth-eye:hover { color: #fff; }
.auth-eye:focus-visible { outline: 2px solid #fff; }
.auth-eye .icon { width: 20px; height: 20px; }

/* 아이콘: SVG 를 글자색으로 칠한다 */
.icon {
  display: block;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
}
.i-eye { --i: url('/icons/eye.svg'); }
.i-eye-off { --i: url('/icons/eye-off.svg'); }
.i-delete { --i: url('/icons/delete.svg'); }

.auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.auth-check input { width: 16px; height: 16px; margin: 0; accent-color: #fff; cursor: pointer; }

/* 로그인 단추 1:22 — 흰 바탕, 파란 글자 */
.auth-btn {
  width: 100%;
  height: 48px;
  margin-top: 23px;   /* 원본: 비밀번호 칸과 단추 사이 43px */
  border: 0;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 4px 4px rgba(0, 0, 0, .3);
  color: var(--bg);
  font: 600 16px/20px var(--font);
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 140ms ease;
}
.auth-btn:hover { background: #eef2ff; }
.auth-btn:active { background: #dfe6fd; }
.auth-btn:disabled { opacity: .7; cursor: default; }
.auth-btn:focus-visible { outline: 3px solid var(--field-focus); outline-offset: 2px; }
/* 보조 단추(인증코드 받기) */
.auth-btn.ghost { width: auto; flex: none; margin: 0; padding: 0 16px; border: 1px solid #fff; background: var(--soft); box-shadow: none; color: #fff; font-size: 14px; }
.auth-btn.ghost:hover { background: rgba(255, 255, 255, .22); }

/* 비밀번호 찾기 1:24 — 단추 아래 오른쪽 */
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: -9px; }
.auth-row .auth-link { margin-left: auto; }
.auth-link { color: #fff; font-size: 16px; font-weight: 500; text-decoration: none; }
.auth-link:hover { text-decoration: underline; }

.auth-foot {
  margin: 12px 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-low);
  word-break: keep-all;
}
.auth-foot a { color: #fff; font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

.auth-error {
  display: none;
  margin: 0;
  padding: 10px 14px;
  border-radius: 4px;
  background: var(--error-bg);
  color: var(--error-fg);
  font-size: 14px;
  line-height: 20px;
}
.auth-error.show { display: block; }

.auth-link-btn {
  align-self: center;
  border: 0;
  background: none;
  padding: 6px 8px;
  color: #fff;
  font: 500 15px/1.4 var(--font);
  cursor: pointer;
}
.auth-link-btn:hover { text-decoration: underline; }

/* ===== PIN: Untitled UI 인증번호 칸(sm·4자리) + 숫자 키패드, 흰 선 ===== */
.pin-code { display: flex; justify-content: center; gap: 8px; }
.pin-code span {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 8px;
  transition: border-color 100ms, box-shadow 100ms;
}
.pin-code span::after {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  transform: scale(.4);
  transition: opacity 100ms, transform 100ms;
}
.pin-code span.on::after { opacity: 1; transform: scale(1); }
.pin-code span.next { border-color: #fff; box-shadow: 0 0 0 3px var(--field-focus); }
.pin-msg { min-height: 20px; margin: -8px 0; text-align: center; font-size: 14px; line-height: 20px; color: #ffd2cc; font-weight: 600; }
.pin-shake { animation: pin-shake .4s; }
@keyframes pin-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pin-pad button {
  height: 60px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #fff;
  font: 400 28px/1 var(--font);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 100ms;
}
.pin-pad button:hover { background: var(--hover); }
.pin-pad button:active { background: rgba(255, 255, 255, .22); }
.pin-pad button:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.pin-pad .pin-blank { visibility: hidden; }
.pin-pad .icon { width: 28px; height: 28px; }

[hidden] { display: none !important; }

/* ===== 회원가입 동의 상자 ===== */
.agree-box {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 4px;
}
.agree-box h3 { margin: 0 0 8px; font-size: 14px; color: #fff; }
.agree-text {
  max-height: 110px;
  overflow-y: auto;
  margin-bottom: 12px;
  padding-right: 6px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink-mid);
}
.agree-box a { color: #fff; }
.agree-box .auth-check { margin: 0; align-items: flex-start; }
.agree-box .auth-check input { margin-top: 2px; }

/* 가입 인증코드 · 비밀번호 찾기 */
.code-row { display: flex; gap: 8px; }
.code-row .auth-input { flex: 1; min-width: 0; }
.auth-note { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-mid); }
.auth-note:empty { display: none; }
.auth-success { margin: 0; padding: 12px 14px; border-radius: 4px; background: var(--success-bg); color: var(--success-fg); font-size: 14px; line-height: 20px; }

@media (pointer: coarse) {
  .auth-input { font-size: 16px; }   /* iOS 확대 방지 */
}
@media (max-width: 480px) {
  .auth { padding: 40px 20px; }
  .auth-panel { gap: 44px; }
  .auth-logo { height: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  .pin-shake { animation: none; }
  .auth-btn, .pin-code span, .pin-code span::after, .pin-pad button { transition: none; }
}

/* 기다릴 때 도는 고리 (Figma Loading Spinner 키트의 'Loading 3': 꼬리가 옅어지는 3/4 원). 색은 글자색을 따른다 */
.spinner {
  display: inline-block;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 25%, currentColor);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
  animation: spinner-turn .9s linear infinite;
}
.spinner[hidden] { display: none; }
@keyframes spinner-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
