/*
 * Snow IAM 로그인 · 등록 · 내 계정 화면 — KMS Admin Console 로그인과 같은 디자인 (AuthSplit · 디자인 §3 · §6 · §7).
 * 토큰은 kms-admin-console/src/styles/index.css 와 같고 액센트만 Snow IAM purple (iam-admin-web index.css [data-accent="purple"]).
 * 다크 기본, <html data-theme="light"> 로 라이트 (theme-init.js 가 콘솔과 같은 localStorage 키 iam-admin-theme 를 읽는다).
 * 좌측 패널 = panel-2 (탑바 계열) + 배경 장면(scene.js), 우측 = panel 위 340px 폼. 모바일(< 768px) 은 폼만.
 */
:root {
  --font-sans: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;
  --surface: #111113; --panel: #19191c; --panel-2: #141416; --edge: #2a2a2e; --fg: #ececec; --muted: #8f8f96; --hover: #232327; --field: #111113;
  --accent: #b056f0; --accent-dim: rgba(176, 86, 240, 0.12); --accent-fg: #b056f0; --accent-hover: #b056f0; --accent-active: #b056f0;
  --disabled: #232327; --disabled-fg: #6b6b72;
  --ok-fg: #2ecc71; --warn-fg: #f1c40f; --danger-fg: #e74c3c; --danger: #e74c3c;
  --radius: 6px; --radius-card: 10px;
  color-scheme: dark;
}
[data-theme="light"] {
  --surface: #ebebee; --panel: #ffffff; --panel-2: #ebebee; --edge: #cfcfd6; --fg: #111114; --muted: #3f3f48; --hover: #e1e1e6; --field: #ffffff;
  --accent: #7a34c9; --accent-dim: rgba(122, 52, 201, 0.12); --accent-fg: #6b2bb3; --accent-hover: #6b2bb3; --accent-active: #5a2399;
  --disabled: #f0f0f3; --disabled-fg: #9d9da6;
  --ok-fg: #107c10; --warn-fg: #d97706; --danger-fg: #c50f1f; --danger: #c50f1f;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* 인라인 SVG 의 hidden 도 확실히 숨긴다 (비밀번호 표시 토글) */
html, body { height: 100%; }
body { margin: 0; background: var(--surface); color: var(--fg); font-family: var(--font-sans); font-size: 13px; line-height: 1.5; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
/* 비밀번호 마스킹 점만 라틴 폰트로 — 한글 폰트의 U+2022 는 전각이라 점 사이가 벌어진다 */
input[type="password"] { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent-fg); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 2단 스플릿 ── */
.auth { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
/* 오른쪽이 길어 스크롤돼도 왼쪽은 화면에 붙어 늘 가득 찬다 (sticky + 100vh) */
.aside { position: sticky; top: 0; height: 100vh; display: none; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 48px; background: var(--panel-2); border-right: 1px solid var(--edge); }
.aside .scene { position: absolute; inset: 0; }
.aside .scene svg { display: block; width: 100%; height: 100%; }
.brand { position: relative; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; color: var(--fg); }
.brand-mark { width: 20px; height: 20px; display: block; }
.foot { position: relative; margin: 0; font-size: 10px; color: var(--muted); }
.pane { display: flex; align-items: center; justify-content: center; background: var(--panel); padding: 40px 24px; }
.col { display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 340px; }
.col.settings { max-width: 760px; }
/* 모바일에서만 폼 위에 작은 브랜드 */
.brand-mobile { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
@media (min-width: 768px) {
  .auth:not(.plain) { grid-template-columns: 1fr 1fr; }
  .auth:not(.plain) .aside { display: flex; }
  .auth:not(.plain) .brand-mobile { display: none; }
}
/* plain — 로그인 흐름 밖 화면(내 계정): 장면 패널 없이 브랜드 · 내용 · 바닥글 한 단, 바탕은 surface 위 카드 */
.auth.plain .pane { background: var(--surface); align-items: flex-start; padding-top: 56px; }
.auth.plain .card { background: var(--panel); }
.foot.center { text-align: center; margin-top: 12px; }

/* ── 제목 · 본문 ── */
.head { display: flex; flex-direction: column; gap: 6px; }
h1 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.3; }
h2 { margin: 0; font-size: 13px; font-weight: 600; }
.sub, .lead { margin: 0; font-size: 12.5px; color: var(--muted); }
.muted { color: var(--muted); }
.hint { margin: 0; font-size: 11.5px; color: var(--muted); }
.notice { margin: 0; font-size: 12px; }
.notice.error { color: var(--danger-fg); }
.notice.ok { color: var(--ok-fg); }
.tag { display: inline-block; margin-left: 6px; padding: 0 6px; border: 1px solid var(--accent); border-radius: 999px; font-size: 10px; font-weight: 600; line-height: 16px; color: var(--accent-fg); vertical-align: middle; }

/* ── 폼 (디자인 §6: field 배경 + edge 보더, focus accent) ── */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 11px; color: var(--muted); }
input[type="text"], input[type="password"], input[type="email"] {
  width: 100%; height: 36px; padding: 4px 10px; border: 1px solid var(--edge); border-radius: var(--radius); background: var(--field); color: var(--fg); font: inherit; font-size: 13px;
}
input::placeholder { color: var(--muted); }
input:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
input:focus { outline: none; border-color: var(--accent); }
input:disabled { background: var(--hover); color: var(--muted); opacity: .6; cursor: not-allowed; }
input.code { font-size: 18px; letter-spacing: 6px; text-align: center; }
.pw { position: relative; }
.pw input { padding-right: 36px; }
.pw .eye { position: absolute; right: 0; top: 0; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: var(--radius); }
.pw .eye:hover { color: var(--fg); }
.pw .eye svg { width: 16px; height: 16px; }
.row { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.row a:hover, .row button:hover { color: var(--fg); text-decoration: none; }

/* ── 버튼 (디자인 §3: 다크 틴트 · 라이트 솔리드, 36px lg) ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 36px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--edge); background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; text-decoration: none; transition: color .12s, background-color .12s, border-color .12s; }
.btn:hover { border-color: var(--accent); color: var(--fg); text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .6; pointer-events: none; }
.btn.primary { border-color: color-mix(in srgb, var(--accent) 25%, transparent); background: var(--accent-dim); color: var(--fg); font-weight: 600; }
.btn.primary:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 25%, transparent); }
.btn.danger { border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger-fg); }
.btn.danger:hover { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn.small { width: auto; height: 28px; padding: 0 10px; font-size: 11px; }
.ico { width: 16px; height: 16px; }
[data-theme="light"] .btn { background: var(--panel); color: var(--fg); }
[data-theme="light"] .btn:hover { border-color: var(--edge); background: var(--hover); }
[data-theme="light"] .btn:active { background: var(--edge); }
[data-theme="light"] .btn.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
[data-theme="light"] .btn.primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
[data-theme="light"] .btn.primary:active { border-color: var(--accent-active); background: var(--accent-active); }
[data-theme="light"] .btn.danger { border-color: var(--danger-fg); background: var(--danger-fg); color: #fff; }
[data-theme="light"] .btn.danger:hover { background: color-mix(in srgb, var(--danger-fg) 85%, black); border-color: color-mix(in srgb, var(--danger-fg) 85%, black); }
[data-theme="light"] .btn:disabled { opacity: 1; border-color: var(--disabled); background: var(--disabled); color: var(--disabled-fg); }

.divider { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--muted); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--edge); }

/* ── 카드 (등록 선택지 · 내 계정 섹션) ── */
.card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--edge); border-radius: var(--radius-card); background: var(--surface); }
[data-theme="light"] .card { background: var(--panel); }
.card p { margin: 0; font-size: 12px; color: var(--muted); }
.card .actions { display: flex; gap: 8px; align-items: center; }
.qr { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qr img { border: 1px solid var(--edge); border-radius: var(--radius); background: #fff; }
.mono { font-size: 11.5px; color: var(--muted); }
.mono code { font: inherit; letter-spacing: .5px; color: var(--fg); }
/* 패스키 목록 — 한 항목 = 이름(수정) + 삭제 / 등록일 · 마지막 사용. 좁아도 줄바꿈으로 구겨지지 않는다 */
.list { display: flex; flex-direction: column; }
.item { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--edge); }
.item:first-child { padding-top: 0; }
.item:last-child { border-bottom: 0; }
.item .top { display: flex; gap: 6px; align-items: center; }
.item .top form { flex: 1; }
.item .top input[type="text"] { flex: 1; min-width: 0; }
.item .meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline input[type="text"] { height: 28px; font-size: 12px; }
.btn.small { flex: none; }
.links { display: flex; flex-direction: column; gap: 6px; }

/* ── 내 계정 (KMS 설정 페이지 틀) — 페이지 헤더 · 왼쪽 목차 · 섹션 제목 + 항목 행 ── */
.page-head { display: flex; flex-direction: column; gap: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--edge); }
.page-head h1 { font-size: 18px; }
.page-head .meta { margin: 0; font-size: 12px; color: var(--muted); }
.page-head .meta strong { color: var(--fg); font-weight: 600; }
.settings-grid { display: grid; gap: 16px; }
.toc { display: flex; gap: 4px; overflow-x: auto; }
.toc a { flex: none; padding: 4px 10px; border-radius: 6px; font-size: 12.5px; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--fg); text-decoration: none; }
.toc a[aria-current="true"] { background: var(--accent-dim); color: var(--fg); font-weight: 600; }
.sections { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sections section { display: flex; flex-direction: column; gap: 4px; }
.sections section + section { padding-top: 16px; }
.sections h2 { padding: 0 14px 4px; font-size: 16px; font-weight: 600; scroll-margin-top: 8px; }
.srow { display: flex; flex-direction: column; gap: 10px; padding: 10px 14px; border-radius: 6px; }
.srow:hover { background: color-mix(in srgb, var(--hover) 50%, transparent); }
.srow-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.srow .t { font-size: 13px; font-weight: 600; }
.srow .d { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.srow .actions { display: flex; gap: 6px; flex: none; }
.srow .list { border-top: 1px solid var(--edge); padding-top: 4px; }
.form.narrow { max-width: 340px; }
@media (max-width: 767px) {
  .toc a { border: 1px solid var(--edge); border-radius: 999px; font-size: 11px; }
  .toc a[aria-current="true"] { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
}
@media (min-width: 768px) {
  .settings-grid { grid-template-columns: 160px minmax(0, 1fr); gap: 0; }
  .toc { position: sticky; top: 24px; flex-direction: column; align-self: start; overflow: visible; border-right: 1px solid var(--edge); padding-right: 12px; }
  .toc a { text-align: left; }
  .sections { padding-left: 20px; }
}
