/* ---------- 로그인 전 화면 (auth/*) ----------
   app.css 뒤에 읽힌다. 어두운 캔버스 위 흰 카드 하나 — 딜러를 아직 모르는 화면이라
   DRIVE 제품 마크를 쓰고, 단일 딜러 모드(PIN)에서는 설정 brand_color 가 --brand 로 들어온다.
   토큰은 app.css 의 것을 쓰되(var(--brand, var(--red)) 식 폴백) 여기서만 쓰는 값은 직접 적는다. */

html, body { background: #16181d; }
body { color: var(--ink); }

.auth-wrap {
  min-height: 100vh; min-height: 100svh;
  display: grid; grid-template-rows: 1fr auto 1fr; justify-items: center; align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 16px calc(env(safe-area-inset-bottom, 0px) + 24px);
  background:
    radial-gradient(900px 540px at 50% -10%, #22262e 0%, rgba(34,38,46,0) 62%),
    #16181d;
  background:
    radial-gradient(900px 540px at 50% -10%, #22262e 0%, rgba(34,38,46,0) 62%),
    radial-gradient(520px 320px at 50% 112%, color-mix(in srgb, var(--brand, var(--red)) 14%, transparent) 0%, transparent 70%),
    #16181d;
}
.auth-wrap::before { content: ""; }        /* 위쪽 빈 줄 — 카드가 화면 가운데에 선다 */
.auth-main { width: 100%; display: grid; justify-items: center; gap: 18px; }

.auth-card {
  width: min(420px, 100%);
  background: var(--card, #fff); border-radius: 16px;
  padding: 32px 28px 24px;
  box-shadow: 0 24px 64px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.05);
}
.auth-card.wide { width: min(460px, 100%); }
@media (max-width: 480px) { .auth-card { padding: 28px 22px 20px; } }

/* 제품 마크: 모노그램 + 워드마크 */
.pmark { display: inline-flex; align-items: center; gap: 10px; vertical-align: middle; }
.pmark .mono { width: 36px; height: 36px; flex: 0 0 auto; display: block; }
.pmark .word { font-size: 20px; font-weight: 800; letter-spacing: 2px; line-height: 1; color: var(--ink); }
.pmark .word::after { content: "."; color: var(--brand, var(--red)); }
.pmark.sm .mono { width: 28px; height: 28px; }
.pmark.sm .word { font-size: 16px; }
.auth-card.center { text-align: center; }
.auth-card.center .pmark { justify-content: center; }

.auth-title { font-size: 22px; font-weight: 750; letter-spacing: -.01em; line-height: 1.25; margin: 24px 0 4px; color: var(--ink); }
.auth-sub { font-size: 14px; color: var(--ink-2); margin: 0 0 24px; line-height: 1.5; }
.auth-sub + .flash { margin-top: -8px; }

/* 하단 안내줄 + 외부 링크 */
.auth-foot { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.auth-foot a { color: var(--ink-2); font-weight: 600; }
.auth-foot a:hover { text-decoration: underline; }
.auth-card .btn + .btn, .auth-card form + .btn { margin-top: 8px; }

/* 'or' 구분줄 */
.or-row { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; color: var(--ink-3); font-size: 12px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; }
.or-row::before, .or-row::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* 언어 전환 — 어두운 바탕 위 .vtog */
.vtog.auth-lang { display: inline-flex; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); }
.vtog.auth-lang button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 56px; padding: 0 14px;
  font: inherit; font-size: 13.5px; font-weight: 700; color: #9ba1aa; background: none; border: 0; border-radius: 0; cursor: pointer; -webkit-appearance: none; appearance: none;
}
.vtog.auth-lang button.on { background: rgba(255,255,255,.14); color: #fff; }
.vtog.auth-lang button:hover { color: #fff; }
.vtog.auth-lang button:focus-visible { outline: none; box-shadow: inset 0 0 0 2px #fff; }

.auth-legal { align-self: end; margin: 0; padding-top: 20px; font-size: 11.5px; color: #9ba1aa; text-align: center; letter-spacing: .2px; line-height: 1.5; }
.auth-legal b { color: #cfd3da; font-weight: 700; letter-spacing: 1.6px; margin-right: 6px; }
.auth-legal b::after { content: "."; color: var(--brand, var(--red)); }

/* ----- 카드 안 컨트롤 크기 (로그인은 한 손 입력이라 앱 본문보다 한 단계 크다) ----- */
.auth-card .fld { display: block; margin-bottom: 16px; }
.auth-card .lbl { display: block; font-size: 12.5px; font-weight: 650; color: var(--ink-2); margin-bottom: 6px; }
.auth-card input:not([type=hidden]), .auth-card select { min-height: 46px; font-size: 16px; padding: 10px 12px; }
.auth-card .btn { min-height: 46px; font-size: 15px; font-weight: 650; gap: 10px; box-shadow: 0 1px 2px rgba(16,24,40,.06); border-color: #cfd4dc; }
.auth-card .btn.ghost { box-shadow: none; border-color: transparent; }
.auth-card .btn.primary { min-height: 48px; margin-top: 8px; border-color: var(--brand, var(--red)); background: var(--brand, var(--red)); box-shadow: 0 1px 2px rgba(0,0,0,.12), inset 0 -1px 0 rgba(0,0,0,.10); }
.auth-card .btn.primary:hover { background: var(--brand-dark, var(--red-dark)); border-color: var(--brand-dark, var(--red-dark)); }
/* 키보드 포커스 링 — 위 장식 그림자가 app.css .btn:focus-visible 를 덮으므로 여기서 다시 선언.
   주 버튼(브랜드색 바탕)은 흰 2px 간격을 두어 링이 카드 위에서도 보인다. */
.auth-card .btn:focus-visible, .auth-card .btn.ghost:focus-visible { box-shadow: 0 0 0 3px rgba(195,0,47,.35); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, var(--red)) 35%, transparent); }
.auth-card .btn.primary:focus-visible { box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(195,0,47,.55); box-shadow: 0 0 0 2px #fff, 0 0 0 4px color-mix(in srgb, var(--brand, var(--red)) 55%, transparent); }
.auth-card .btn svg.g { width: 18px; height: 18px; flex: 0 0 auto; }
.auth-card .btn .ico { width: 18px; height: 18px; }

/* ----- PIN 모드 (단일 딜러): 사용자 타일 + PIN 칸 ----- */
.user-tiles { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 22px 0; }
.user-tile {
  border: 1px solid #cfd4dc; border-radius: 12px; padding: 14px 18px; min-width: 100px; flex: 0 1 auto;
  background: #fff; cursor: pointer; font: inherit; color: var(--ink); text-align: center;
  box-shadow: 0 1px 2px rgba(16,24,40,.06); transition: border-color .12s, box-shadow .12s, background .12s;
}
.user-tile:hover { border-color: #c2c8d0; background: #f8f9fa; }
.user-tile.selected { border-color: var(--brand, var(--red)); background: #fbe9ec; background: color-mix(in srgb, var(--brand, var(--red)) 8%, #fff); box-shadow: 0 0 0 3px rgba(195,0,47,.22); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, var(--red)) 25%, transparent); }
.user-tile:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(195,0,47,.22); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, var(--red)) 25%, transparent); }
.user-tile .avatar, .auth-card .avatar {
  width: 44px; height: 44px; border-radius: 99px; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 18px;
}
.user-tile .nm { display: block; font-weight: 700; font-size: 14.5px; line-height: 1.3; }
.user-tile .rl { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.user-tile.selected .rl { color: var(--ink-2); }   /* 브랜드색 8% 틴트 위에서도 AA */
.auth-card input.pin { text-align: center; font-size: 22px; letter-spacing: 8px; font-variant-numeric: tabular-nums; }
.auth-card input.pin::placeholder { letter-spacing: 1px; font-size: 16px; color: #8c929b; }  /* 장식용 점 — 글자 placeholder 는 아래 ink-3 */
.who { display: flex; flex-direction: column; align-items: center; margin: 20px 0 6px; }
.who .avatar { margin: 0 0 10px; }
.who .nm { display: block; font-weight: 700; font-size: 16px; }
.who .un { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

/* ----- 구글 데모 계정 타일 ----- */
.acct {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 1px solid #cfd4dc; border-radius: 12px; padding: 12px 14px; min-height: 64px;
  background: #fff; cursor: pointer; font: inherit; color: var(--ink); margin-top: 8px;
  box-shadow: 0 1px 2px rgba(16,24,40,.06);
}
.acct:hover { background: #f8f9fa; border-color: #c2c8d0; }
.acct:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(195,0,47,.22); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, var(--red)) 25%, transparent); }
.acct .avatar { width: 38px; height: 38px; margin: 0; font-size: 15px; flex: none; }
.acct .nm { font-weight: 700; display: block; line-height: 1.3; }
.acct .em { font-size: 12.5px; color: var(--ink-3); display: block; }
.auth-card .empty { padding: 24px 12px; }

/* ===== until app.css tokens land (Branch B) - identical values, delete after merge ===== */
.auth-card input:where(:not([type]), [type=search]) {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; background: #fff; color: var(--ink); min-height: 40px;
}
/* 기본 상자는 :where() 로 특이도를 (0,1,1) 에 묶는다 — 아래 :hover / :focus / .is-invalid (0,2,1) 가 이겨야 한다. */
.auth-card input:where(:not([type=hidden], [type=checkbox], [type=radio])), .auth-card :where(select) {
  border: 1px solid #cfd4dc; border-radius: 10px; box-shadow: inset 0 1px 2px rgba(16,24,40,.05);
  transition: border-color .12s, box-shadow .12s;
}
.auth-card input:hover { border-color: #c2c8d0; }
.auth-card input:focus { border-color: var(--brand, var(--red)); box-shadow: 0 0 0 3px rgba(195,0,47,.22); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, var(--red)) 25%, transparent); }
.auth-card input::placeholder { color: var(--ink-3); }
.auth-card input:-webkit-autofill, .auth-card input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fff inset; -webkit-text-fill-color: var(--ink); caret-color: var(--ink); transition: background-color 9999s;
}
.fld.is-invalid :is(input, select, textarea) { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(185,28,28,.16); }
.fld-err { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--bad); line-height: 1.4; }
.fld-err[hidden] { display: none; }
.fld-err svg { flex: 0 0 auto; margin-top: 2px; }
.fld-help, .auth-card .hint { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.45; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input, .auth-card .pw-wrap input { padding-right: 50px; }
.pw-eye {
  position: absolute; right: 1px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border: 0; background: none; border-radius: 9px;   /* 폰 탭 타깃 44px */
  color: var(--ink-3); display: grid; place-items: center; cursor: pointer; padding: 0;
}
.pw-eye:hover { color: var(--ink); background: #eff1f4; }
.pw-eye:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(195,0,47,.22); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, var(--red)) 25%, transparent); }
.pw-eye svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.pw-eye .slash { display: none; }
.pw-eye.is-on .slash { display: block; }
form[aria-busy="true"] .btn.primary, .btn[aria-busy="true"] { opacity: .7; pointer-events: none; }
.auth-card .flash {
  display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; margin: 0 0 16px;
  font-size: 13.5px; font-weight: 600; line-height: 1.45; border: 1px solid transparent;
}
.auth-card .flash svg { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.auth-card .flash.error { background: #fdecec; border-color: #f5c6c6; color: var(--bad); }
.auth-card .flash.success { background: #e7f6ee; border-color: #bfe5cf; color: #0b6b3a; }   /* 5.9:1 (--ok 는 3.95:1) */
.auth-card .flash.info { background: #e8eefc; border-color: #c3d2f7; color: var(--blue); }
@media (forced-colors: active) {
  .user-tile.selected, .user-tile:focus-visible, .acct:focus-visible, .pw-eye:focus-visible,
  .vtog.auth-lang button:focus-visible, .auth-card .btn:focus-visible { outline: 2px solid; outline-offset: 1px; }
}
/* 인쇄: 어두운 캔버스 대신 흰 종이 — 언어줄·하단 문구가 보이게 */
@media print {
  html, body, .auth-wrap { background: #fff; }
  .auth-card { box-shadow: none; border: 1px solid #ccc; }
  .vtog.auth-lang { background: none; border-color: #ccc; }
  .vtog.auth-lang button, .vtog.auth-lang button.on, .auth-legal, .auth-legal b { color: #333; background: none; }
}
