:root {
  --navy: #1A2B44; --navy-d: #0E1828; --ink: #1A2B44; --muted: #5A6575; --line: #DDE3EA; --line2: #EDF0F4;
  --bg: #F4F6F9; --card: #FFFFFF; --red: #A4262C; --green: #1C6B43; --amber: #FFC857;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Noto Sans KR", sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--ink); }
a:hover { color: var(--navy-d); }
h1 { margin: 0; font-size: 26px; }
h2 { margin: 0; font-size: 19px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.main { padding-top: 32px; padding-bottom: 48px; display: flex; flex-direction: column; gap: 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.strong { font-weight: 600; }
.right { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* GNB */
.gnb { background: var(--navy); color: #fff; }
.gnb-in { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; }
.brand:hover { color: #fff; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; flex-grow: 1; }
.nav a { color: #DCE3EC; text-decoration: none; padding: 10px 14px; border-radius: 6px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a[aria-current] { color: #fff; background: rgba(255,255,255,.14); }
.count { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--amber); color: var(--navy); font-size: 12px; font-weight: 700; }
.acct { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid rgba(255,255,255,.3); background: transparent; color: #fff; font: inherit; font-size: 14px; cursor: pointer; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--amber); color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.menu { inset: 64px 16px auto auto; margin: 0; width: 260px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.2); background: #fff; color: var(--ink); }
.menu-me { padding: 10px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line2); display: flex; flex-direction: column; gap: 4px; }
.menu-me .role { align-self: flex-start; margin-top: 4px; }
.menu a, .menu button { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 12px; border-radius: 8px; text-decoration: none; font: inherit; font-size: 14px; color: var(--ink); background: none; border: 0; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--bg); }
.menu form { margin: 0; }

/* 공통 */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.head p { margin: 4px 0 0; font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.btn, .btn2 { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 8px; font: inherit; font-size: 15px; text-decoration: none; cursor: pointer; }
.btn { background: var(--navy); color: #fff; border: 0; font-weight: 600; }
.btn:hover { background: var(--navy-d); color: #fff; }
.btn2 { background: #fff; color: var(--ink); border: 1px solid #C5CED9; }
.btn-red { background: var(--red); }
.btn-red:hover { background: #7E1C21; }
.btn-lg { min-height: 50px; font-size: 16px; width: 100%; }
.lk { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; font-size: 14px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; background: #EEF1F5; color: #4A5565; }
.badge-ok { background: #E6F4EC; color: var(--green); }
.badge-bad { background: #FDE7E7; color: var(--red); }
.badge-warn { background: #FFF1E0; color: #8A4B00; }
.badge-muted { background: #EEF1F5; color: #4A5565; }
.role { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.role-super { background: #FFF3D1; color: #6B4A00; }
.role-admin { background: #E3ECF7; color: var(--navy); }
.alert { padding: 12px 14px; border-radius: 8px; font-size: 14px; }
.alert-err { background: #FDE7E7; color: #7E1C21; }
.alert-ok { background: #E6F4EC; color: #145233; }
.alert-info { background: var(--bg); color: #4A5565; }
.note { margin: 0; padding: 12px 14px 12px 14px; border-radius: 8px; background: var(--bg); font-size: 13px; line-height: 1.6; color: #4A5565; }
ul.note { padding-left: 30px; }
.empty { margin: 0; padding: 40px 16px; text-align: center; color: var(--muted); }

/* 입력 */
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld > label { font-size: 13px; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.inp { min-height: 44px; padding: 0 12px; border: 1px solid #C5CED9; border-radius: 8px; font: inherit; font-size: 15px; background: #fff; color: var(--ink); width: 100%; }
textarea.inp { padding: 10px 12px; resize: vertical; }
.inp-lg { min-height: 48px; font-size: 16px; }
.inp-sm { width: auto; min-height: 40px; font-size: 14px; }
.inp:focus, .btn:focus-visible, .btn2:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid #3B7DD8; outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.check input { width: 20px; height: 20px; margin: 0; flex-shrink: 0; }
.opts { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 8px; }
.opts legend { font-size: 13px; color: var(--muted); padding-bottom: 6px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.opt input { width: 20px; height: 20px; margin: 2px 0 0; }
.opt > span { display: flex; flex-direction: column; gap: 2px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* 필터·표·페이지 */
.filters { padding: 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters .fld { flex: 0 1 180px; }
.filters .grow { flex: 1 1 240px; }
.reset { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; font-size: 14px; color: var(--muted); }
.table-box { overflow-x: auto; }
.t { width: 100%; min-width: 820px; border-collapse: collapse; }
.t th { background: #F7F9FB; color: var(--muted); text-align: left; font-size: 13px; font-weight: 500; padding: 12px 16px; }
.t td { padding: 12px 16px; border-top: 1px solid var(--line2); vertical-align: top; }
.t-sm { font-size: 14px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.pager-info { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); margin: 0; }
.pager-nums { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.pager-nums > * { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border-radius: 8px; text-decoration: none; font-size: 14px; }
.pager-nums [aria-current] { background: var(--navy); color: #fff; font-weight: 700; }
.pager-nums [aria-disabled] { color: #8A96A6; }

/* 모달 */
.dlg { padding: 0; border: 0; border-radius: 14px; width: min(560px, calc(100% - 32px)); max-height: calc(100% - 64px); box-shadow: 0 20px 50px rgba(0,0,0,.25); color: var(--ink); }
.dlg-wide { width: min(1040px, calc(100% - 32px)); }
.dlg::backdrop { background: rgba(14,24,40,.55); }
.dlg-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 16px 24px; border-bottom: 1px solid var(--line2); }
.dlg-b { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dlg-f { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid var(--line2); }
.x { width: 44px; height: 44px; color: var(--muted); display: flex; align-items: center; justify-content: center; border-radius: 8px; }

/* 로그인 등 단독 화면 */
body.auth { background: var(--navy); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 36px 28px; display: flex; flex-direction: column; gap: 22px; }
.auth-head { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.auth-head h1 { font-size: 22px; }
.auth-head p { margin: 0; }
.auth-foot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.auth-foot p { margin: 0; }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .main { padding-top: 20px; }
  .menu { inset: 64px 8px auto auto; }
  .dlg { width: 100%; max-width: none; max-height: 100%; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .dlg-wide { height: 100%; border-radius: 0; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}

/* 패스키 목록 */
.keys { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; }
.keys li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 14px; border-top: 1px solid var(--line2); }
.keys li:first-child { border-top: 0; }
.keys li > span { display: flex; flex-direction: column; }
.keys form { margin: 0; }
.keys .lk { border: 0; background: none; color: var(--red); cursor: pointer; font: inherit; font-size: 14px; }
[hidden] { display: none !important; }

/* 대상자 등록 */
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.summary { display: flex; flex-wrap: wrap; gap: 8px; }
.scroll { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.scroll .t { min-width: 640px; }
.danger-text { color: var(--red); border-color: #E8B4B7; }
.spacer { flex-grow: 1; }
.dlg-f .spacer + .btn2 { margin-left: 0; }
