/* SSO 공통 스타일 — CMS 규약 동일: 흰 바탕(라이트) 기본.
   레이아웃: 상단 고정 메뉴바 + 와이드 콘텐츠(1920 최적화) + 모바일 반응형. */
:root {
  --bg: #ffffff;
  --fg: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #1d4ed8;
  --danger: #dc2626;
  --nav-h: 56px;
}
* { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--fg); margin: 0;
  font-family: "Pretendard", "Malgun Gothic", system-ui, sans-serif; }

/* ── 상단 메뉴바 ── */
.topnav { position: sticky; top: 0; z-index: 10; display: flex; align-items: center;
  gap: 24px; height: var(--nav-h); padding: 0 24px; background: var(--bg);
  border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 16px;
  font-weight: 600; color: var(--fg); text-decoration: none; white-space: nowrap; }
.brand-logo { width: 26px; height: 26px; display: block; }
/* 로그인 카드 상단 로고 — 로고·제목·부제를 가운데 정렬로 묶음 */
.login-logo { width: 56px; height: 56px; display: block; margin: 0 auto 14px; }
.login-card h1, .login-card .sub { text-align: center; }
.brand b { color: var(--primary); }
.topnav-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.topnav-nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted);
  text-decoration: none; font-size: 14px; white-space: nowrap; }
.topnav-nav a:hover { background: #f3f4f6; color: var(--fg); }
.topnav-nav a.active { background: #eef2ff; color: var(--primary); font-weight: 600; }
.topnav-user { display: flex; align-items: center; gap: 12px; font-size: 13px;
  color: var(--muted); white-space: nowrap; }

/* ── 콘텐츠 영역 ── */
.sso-main { max-width: 1440px; margin: 0 auto; padding: 32px 24px; }
/* 로그인·MFA 등 단일 카드 화면은 세로 중앙 정렬 */
.sso-main.centered { min-height: calc(100vh - var(--nav-h)); display: flex;
  flex-direction: column; align-items: center; justify-content: center; gap: 16px; }

.card { width: 100%; max-width: 380px; margin: 0 auto; border: 1px solid var(--border);
  border-radius: 12px; padding: 32px; background: var(--bg); }
.card.wide { max-width: 1200px; }
.card.dash { max-width: 1320px; }
.card h1 { margin: 0 0 4px; font-size: 22px; }
.card .sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; }

label { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
input[type=text], input[type=password] { width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 15px; }
button[type=submit] { width: 100%; margin-top: 20px; padding: 11px;
  background: var(--primary); color: #fff; border: 0; border-radius: 8px;
  font-size: 15px; cursor: pointer; }
form.inline { display: inline; }
button.linklike { width: auto; margin: 0; padding: 0; background: none;
  color: var(--primary); font-size: inherit; text-decoration: underline;
  cursor: pointer; border: 0; }

.kv { display: grid; grid-template-columns: 84px 1fr; gap: 6px 12px;
  font-size: 14px; margin: 16px 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

.messages { max-width: 1200px; margin: 0 auto 16px; }
.centered .messages { max-width: 380px; width: 100%; margin: 0; }
.msg { padding: 10px 12px; border-radius: 8px; font-size: 14px;
  border: 1px solid var(--border); margin: 0 0 8px; }
.msg-error { color: var(--danger); border-color: var(--danger); }
.msg-success { color: #047857; border-color: #047857; }

/* ── 홈: 앱 런처 ── */
.apps-title { margin: 20px 0 12px; font-size: 15px; color: var(--muted);
  font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px; }
.app-card { display: flex; align-items: center; gap: 12px; padding: 16px;
  border: 1px solid var(--border); border-radius: 12px; text-decoration: none;
  color: var(--fg); background: var(--bg);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.app-card:hover { border-color: var(--primary); transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(29, 78, 216, .14); }
.app-avatar { width: 44px; height: 44px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; font-weight: 700; font-size: 17px; }
.app-meta { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.app-name { font-weight: 600; font-size: 14px; }
.app-host { color: var(--muted); font-size: 12px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.app-arrow { margin-left: auto; color: var(--muted); font-size: 15px;
  transition: color .15s ease, transform .15s ease; }
.app-card:hover .app-arrow { color: var(--primary); transform: translateX(2px); }

/* ── 관리자 대시보드 ── */
.period-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.period-tabs a { padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 13px; }
.period-tabs a.active { background: #eef2ff; border-color: var(--primary);
  color: var(--primary); font-weight: 600; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 8px; }
.stat { border: 1px solid var(--border); border-radius: 10px; padding: 16px;
  display: flex; flex-direction: column; gap: 4px; }
.stat-num { font-size: 24px; font-weight: 700; }
.stat-num.bad, .bad { color: var(--danger); }
.stat-label { font-size: 12px; color: var(--muted); }
.card.dash h2, .card.wide h2 { font-size: 14px; color: var(--muted);
  margin: 20px 0 8px; font-weight: 600; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 24px; }
.table-wrap { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-table td, .dash-table th { border-bottom: 1px solid var(--border);
  padding: 6px 8px; text-align: left; white-space: nowrap; }
.dash-table th { color: var(--muted); font-weight: 600; }
.dash-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.dash-table .empty { color: var(--muted); white-space: normal; }

/* ── MFA(TOTP) 등록/검증 ── */
.qr { display: flex; justify-content: center; margin: 8px 0; }
.qr svg { width: 180px; height: 180px; }
.secret { font-size: 12px; color: var(--muted); word-break: break-all;
  text-align: center; }
.alt-action { margin-top: 16px; text-align: center; }

/* ── 백업 코드 / 내 보안 ── */
.backup-codes { list-style: none; padding: 0; margin: 16px 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.backup-codes code { display: block; padding: 8px 10px; text-align: center;
  border: 1px dashed var(--border); border-radius: 8px; font-size: 15px;
  letter-spacing: .08em; background: #f9fafb; }
.btn-primary-link { display: block; width: 100%; margin-top: 12px; padding: 11px;
  background: var(--primary); color: #fff; border-radius: 8px; text-align: center;
  text-decoration: none; font-size: 15px; }
.sec-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.sec-form { display: flex; gap: 8px; flex: 1 1 300px; }
.sec-form input[type=text] { flex: 1; margin: 0; }
.sec-form button { width: auto; margin: 0; padding: 10px 14px; white-space: nowrap;
  background: var(--primary); color: #fff; border: 0; border-radius: 8px;
  font-size: 14px; cursor: pointer; }

/* ── 모바일 ── */
@media (max-width: 640px) {
  .topnav { gap: 12px; padding: 0 12px; }
  .topnav-name { display: none; }
  .sso-main { padding: 16px 12px; }
  .card { padding: 20px; }
  .sec-form { flex-direction: column; }
  .sec-form button { width: 100%; }
  .dash-grid { grid-template-columns: 1fr; }
}
