/*
 * M18 관리자 모듈(SCR-A5·A6·A8·A9) 전용 스타일. design.md §1 토큰만 사용.
 * shared.css 프리미티브(kx-page·kx-card·kx-table·kx-select 등) 선반영.
 */
@import '../shared.css';

/* ── 공통 헤더 ── */
.kx-adm__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.kx-adm__title {
  font-size: var(--fs-h1);
  line-height: var(--lh-h1);
  font-weight: var(--fw-bold);
  color: var(--color-neutral-900);
}
.kx-adm__subtitle {
  margin-top: 4px;
  font-size: var(--fs-body);
  color: var(--color-neutral-500);
  max-width: 720px;
}

/* ── 폼 필드 프리미티브(관리자 모듈 격리 — .kx-field 전역 충돌 방지) ── */
.kx-adm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.kx-adm-field__label {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--color-neutral-500);
}
.kx-adm-field__hint {
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
}
.kx-adm-field__input {
  height: 36px;
  padding: 0 var(--space-3);
  border: var(--border-card);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  font-size: var(--fs-body);
  color: var(--color-neutral-900);
  width: 100%;
}
.kx-adm-field__input:focus {
  outline: 2px solid var(--color-primary-100);
  border-color: var(--color-primary-600);
}

/* ── 상태 pill ── */
.kx-adm-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  white-space: nowrap;
}
.kx-adm-pill--success { color: var(--color-success); background: #e6f4ee; }
.kx-adm-pill--error { color: var(--color-error); background: #fef3f2; }
.kx-adm-pill--warn { color: var(--color-violation-warn-text); background: var(--color-violation-warn-bg); }
.kx-adm-pill--neutral { color: var(--color-neutral-500); background: var(--color-neutral-100); }

.kx-adm-muted { color: var(--color-neutral-500); }
.kx-adm-mono {
  font-family: ui-monospace, 'JetBrains Mono', 'Menlo', monospace;
  font-size: var(--fs-mono);
  color: var(--color-neutral-700);
  white-space: nowrap;
}

/* ── 샘플/degraded 배너 ── */
.kx-adm-sample-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px dashed var(--color-neutral-200);
  border-radius: var(--radius-lg);
  background: var(--color-neutral-050);
  font-size: var(--fs-body);
  color: var(--color-neutral-700);
}

/* ═══════════ SCR-A5 감사로그 ═══════════ */
.kx-adm-filter__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: var(--space-4);
  align-items: end;
}
.kx-adm-filter__actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}
.kx-adm-table-card { padding: 0; overflow: hidden; }

.kx-adm-audit { width: 100%; border-collapse: collapse; }
.kx-adm-audit th,
.kx-adm-audit td {
  padding: 10px 12px;
  text-align: left;
  font-size: var(--fs-body);
  vertical-align: top;
}
.kx-adm-audit thead th {
  background: var(--color-neutral-050);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--color-neutral-500);
  letter-spacing: 0.02em;
  border-bottom: 2px solid var(--color-neutral-200);
  white-space: nowrap;
  vertical-align: bottom;
}
.kx-adm-audit tbody tr { border-bottom: 1px solid var(--color-neutral-200); }
.kx-adm-audit tbody tr:hover { background: var(--color-primary-050); }

.kx-adm-actor { display: flex; align-items: center; gap: var(--space-2); }
.kx-adm-actor__avatar {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: var(--radius-pill);
  background: var(--color-primary-100);
  color: var(--color-primary-700);
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kx-adm-actor__body { display: flex; flex-direction: column; }
.kx-adm-actor__name { font-weight: var(--fw-semibold); color: var(--color-neutral-900); }
.kx-adm-actor__id { font-size: var(--fs-caption); color: var(--color-neutral-500); }

.kx-adm-action {
  display: inline-block;
  font-weight: var(--fw-semibold);
  color: var(--color-neutral-900);
}
.kx-adm-summary {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kx-adm-target { display: flex; flex-direction: column; }
.kx-adm-target__type { font-weight: var(--fw-semibold); color: var(--color-neutral-700); }
.kx-adm-target__id { font-size: var(--fs-caption); color: var(--color-neutral-500); }

.kx-adm-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-top: var(--border-card);
  background: var(--color-neutral-050);
  flex-wrap: wrap;
}
.kx-adm-pager__info { font-size: var(--fs-caption); color: var(--color-neutral-500); }
.kx-adm-pager__nav { display: flex; align-items: center; gap: var(--space-3); }
.kx-adm-pager__page { font-size: var(--fs-body); font-weight: var(--fw-semibold); color: var(--color-neutral-700); }
.kx-adm-pager__size {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
}

/* ═══════════ SCR-A6 시스템설정 ═══════════ */
.kx-adm-settings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: var(--space-4);
}
.kx-adm-group { padding: 0; overflow: hidden; display: flex; }
.kx-adm-group__accent { width: 4px; flex: 0 0 4px; background: var(--color-primary-600); }
.kx-adm-group__body { flex: 1; min-width: 0; padding: var(--space-4); }
.kx-adm-group__title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  color: var(--color-neutral-900);
  margin-bottom: var(--space-3);
  text-transform: capitalize;
}
.kx-adm-setrows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.kx-adm-setrow {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-neutral-100);
}
.kx-adm-setrow:last-child { border-bottom: none; padding-bottom: 0; }
.kx-adm-setrow__meta { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.kx-adm-setrow__key {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--color-neutral-900);
  font-family: ui-monospace, 'JetBrains Mono', monospace;
}
.kx-adm-setrow__desc { font-size: var(--fs-caption); color: var(--color-neutral-500); }
.kx-adm-setrow__control { display: flex; align-items: center; gap: var(--space-2); }
.kx-adm-setrow__input { flex: 1; min-width: 0; }
.kx-adm-setrow__hint { margin-top: 6px; font-size: var(--fs-micro); color: var(--color-neutral-500); }
.kx-adm-secret {
  font-size: var(--fs-nano);
  font-weight: var(--fw-bold);
  color: var(--color-warning);
  background: #fff4e5;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}
.kx-adm-typechip {
  font-size: var(--fs-nano);
  font-weight: var(--fw-bold);
  color: var(--color-neutral-500);
  background: var(--color-neutral-100);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}
.kx-adm-del { color: var(--color-error); }

/* boolean switch */
.kx-adm-switch { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.kx-adm-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.kx-adm-switch__track {
  width: 40px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: var(--color-neutral-200);
  position: relative;
  transition: background 0.15s;
  flex: 0 0 40px;
}
.kx-adm-switch__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  background: var(--color-white);
  transition: transform 0.15s;
}
.kx-adm-switch input:checked + .kx-adm-switch__track { background: var(--color-primary-600); }
.kx-adm-switch input:checked + .kx-adm-switch__track::after { transform: translateX(18px); }
.kx-adm-switch input:focus-visible + .kx-adm-switch__track { outline: 2px solid var(--color-primary-100); }
.kx-adm-switch__label { font-size: var(--fs-caption); color: var(--color-neutral-700); }

.kx-adm-add__title { font-size: var(--fs-h3); font-weight: var(--fw-bold); color: var(--color-neutral-900); margin-bottom: var(--space-3); }
.kx-adm-add__grid {
  display: grid;
  grid-template-columns: 1.4fr 1.4fr 0.8fr;
  gap: var(--space-4);
  align-items: end;
}
.kx-adm-add__desc { grid-column: 1 / -1; }
.kx-adm-add__actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.kx-adm-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-body);
  color: var(--color-neutral-700);
}

/* ═══════════ SCR-A8 룰셋 버전 ═══════════ */
.kx-adm-ruleset { display: grid; grid-template-columns: 300px 1fr; gap: var(--space-4); align-items: start; }
.kx-adm-ruleset__versions { display: flex; flex-direction: column; gap: var(--space-3); }
.kx-adm-ruleset__vhead { display: flex; align-items: center; justify-content: space-between; }
.kx-adm-ruleset__vhead h2 { font-size: var(--fs-h3); font-weight: var(--fw-bold); color: var(--color-neutral-900); }
.kx-adm-vlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.kx-adm-vitem {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-3);
  border: var(--border-card);
  border-left: 4px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--color-white);
  cursor: pointer;
}
.kx-adm-vitem:hover { background: var(--color-neutral-050); }
.kx-adm-vitem.is-active { border-left-color: var(--color-primary-600); background: var(--color-primary-050); }
.kx-adm-vitem__top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.kx-adm-vitem__top strong { font-size: var(--fs-body); color: var(--color-neutral-900); }
.kx-adm-vitem__date { font-size: var(--fs-caption); color: var(--color-neutral-500); }
.kx-adm-vitem__note { font-size: var(--fs-caption); color: var(--color-neutral-500); font-style: italic; }

.kx-adm-ruleset__editor { padding: 0; overflow: hidden; }
.kx-adm-ruleset__ehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: var(--border-card);
}
.kx-adm-ruleset__ehead h2 { font-size: var(--fs-h3); font-weight: var(--fw-bold); color: var(--color-neutral-900); }
.kx-adm-rules { width: 100%; border-collapse: collapse; }
.kx-adm-rules th, .kx-adm-rules td { padding: 10px 12px; text-align: left; font-size: var(--fs-body); }
.kx-adm-rules thead th {
  background: var(--color-neutral-050);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--color-neutral-500);
  letter-spacing: 0.02em;
  border-bottom: 2px solid var(--color-neutral-200);
  white-space: nowrap;
  vertical-align: bottom;
}
.kx-adm-rules tbody tr { border-bottom: 1px solid var(--color-neutral-200); }
.kx-adm-rulename { display: block; font-weight: var(--fw-semibold); color: var(--color-neutral-900); }
.kx-adm-rulecode { display: block; font-size: var(--fs-micro); color: var(--color-neutral-500); font-family: ui-monospace, monospace; }
.kx-adm-disclaimer { padding: var(--space-3) var(--space-4); font-size: var(--fs-caption); color: var(--color-neutral-500); border-top: var(--border-card); }

/* ═══════════ SCR-A9 테넌트 ═══════════ */
.kx-adm-tenant { display: grid; grid-template-columns: 1fr 340px; gap: var(--space-4); align-items: start; }
.kx-adm-tenant__list { padding: 0; overflow: hidden; }
.kx-adm-tenant__lhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: var(--border-card);
}
.kx-adm-tenant__lhead h2 { font-size: var(--fs-h3); font-weight: var(--fw-bold); color: var(--color-neutral-900); }
/* 테넌트 목록 KxDataTable 래퍼 — 카드 padding:0 상쇄(툴바·표·페이저 여백) */
.kx-adm-tenant__tbl { padding: var(--space-3) var(--space-4) var(--space-4); }
.kx-adm-tenants { width: 100%; border-collapse: collapse; }
.kx-adm-tenants th, .kx-adm-tenants td { padding: 10px 12px; text-align: left; font-size: var(--fs-body); }
.kx-adm-tenants thead th {
  background: var(--color-neutral-050);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--color-neutral-500);
  letter-spacing: 0.02em;
  border-bottom: 2px solid var(--color-neutral-200);
  white-space: nowrap;
  vertical-align: bottom;
}
.kx-adm-tenants tbody tr { border-bottom: 1px solid var(--color-neutral-200); }
.kx-adm-tenants tbody tr:hover { background: var(--color-primary-050); }
.kx-adm-tenants tbody tr.is-selected { background: var(--color-primary-050); }
.kx-adm-tenants__name { font-weight: var(--fw-semibold); color: var(--color-neutral-900); }

.kx-adm-tenant__wizard { display: flex; flex-direction: column; gap: 4px; }
.kx-adm-wiz__title { font-size: var(--fs-h3); font-weight: var(--fw-bold); color: var(--color-neutral-900); }
.kx-adm-wiz { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: flex; flex-direction: column; }
.kx-adm-wiz__step { display: flex; gap: var(--space-3); padding-bottom: var(--space-4); position: relative; }
.kx-adm-wiz__step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--color-neutral-200);
}
.kx-adm-wiz__dot {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  background: var(--color-neutral-100);
  color: var(--color-neutral-500);
  z-index: 1;
}
.kx-adm-wiz__step.is-done .kx-adm-wiz__dot { background: var(--color-success); color: var(--color-on-accent); }
.kx-adm-wiz__step.is-current .kx-adm-wiz__dot { background: var(--color-primary-600); color: var(--color-on-accent); }
.kx-adm-wiz__body { display: flex; flex-direction: column; gap: 2px; padding-top: 3px; }
.kx-adm-wiz__label { font-size: var(--fs-body); font-weight: var(--fw-semibold); color: var(--color-neutral-900); }
.kx-adm-wiz__step.is-todo .kx-adm-wiz__label { color: var(--color-neutral-500); }
.kx-adm-wiz__desc { font-size: var(--fs-caption); color: var(--color-neutral-500); }

/* ═══════════ 공통 CRUD (사용자·역할·공통코드·메뉴) ═══════════ */
/* 툴바(검색 + 액션) */
.kx-adm-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.kx-adm-toolbar__filters { display: flex; align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; }
.kx-adm-toolbar__filters .kx-adm-field { min-width: 180px; }
.kx-adm-toolbar__actions { display: flex; gap: var(--space-2); }

/* 일반 관리 테이블(kx-adm-audit 파생) */
.kx-adm-tbl { width: 100%; border-collapse: collapse; }
.kx-adm-tbl th,
.kx-adm-tbl td {
  padding: 10px 12px;
  text-align: left;
  font-size: var(--fs-body);
  vertical-align: middle;
}
.kx-adm-tbl thead th {
  background: var(--color-neutral-050);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--color-neutral-500);
  letter-spacing: 0.02em;
  border-bottom: 2px solid var(--color-neutral-200);
  white-space: nowrap;
  vertical-align: bottom;
}
.kx-adm-tbl tbody tr { border-bottom: 1px solid var(--color-neutral-200); }
.kx-adm-tbl tbody tr:hover { background: var(--color-primary-050); }
.kx-adm-tbl tbody tr.is-selected { background: var(--color-primary-050); }
.kx-adm-tbl__strong { font-weight: var(--fw-semibold); color: var(--color-neutral-900); }
.kx-adm-tbl__actions { display: flex; gap: var(--space-2); justify-content: flex-end; white-space: nowrap; }

/* 역할 칩 */
.kx-adm-rolechip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
}
.kx-adm-rolechip--admin { color: var(--color-error); background: #fef3f2; }
.kx-adm-rolechip--manager { color: var(--color-primary-700); background: var(--color-primary-100); }
.kx-adm-rolechip--user { color: var(--color-neutral-500); background: var(--color-neutral-100); }

/* ── 모달(관리자 격리 — login.css 의존 회피) ── */
.kx-adm-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.kx-adm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.44);
}
.kx-adm-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal, 0 20px 48px rgba(15, 23, 42, 0.24));
  padding: var(--space-5, 24px);
}
.kx-adm-modal__title { font-size: var(--fs-h2); font-weight: var(--fw-bold); color: var(--color-neutral-900); }
.kx-adm-modal__desc { margin-top: 4px; font-size: var(--fs-caption); color: var(--color-neutral-500); }
.kx-adm-modal__grid {
  margin-top: var(--space-4);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.kx-adm-modal__grid .kx-adm-field--full { grid-column: 1 / -1; }
.kx-adm-modal__actions {
  margin-top: var(--space-5, 24px);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}
.kx-adm-modal__error {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: #fef3f2;
  color: var(--color-error);
  font-size: var(--fs-caption);
}
.kx-adm-field__select {
  height: 36px;
  padding: 0 var(--space-3);
  border: var(--border-card);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  font-size: var(--fs-body);
  color: var(--color-neutral-900);
  width: 100%;
}
.kx-adm-secnote {
  margin-top: var(--space-3);
  font-size: var(--fs-micro);
  color: var(--color-neutral-500);
}

/* ── 권한 매트릭스(역할 × 권한) ── */
.kx-adm-matrix { display: grid; grid-template-columns: 280px 1fr; gap: var(--space-4); align-items: start; }
.kx-adm-matrix__roles { padding: 0; overflow: hidden; }
/* 1fr 트랙 min-width:0 — 넓은 매트릭스 표가 트랙을 밀어 그리드를 터뜨리지 않도록(내부 스크롤 활성). */
.kx-adm-matrix__perms { padding: var(--space-4); min-width: 0; }
.kx-adm-permgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.kx-adm-permcheck {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: var(--space-3);
  border: var(--border-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.kx-adm-permcheck input { margin-top: 3px; }
.kx-adm-permcheck__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kx-adm-permcheck__name { font-weight: var(--fw-semibold); color: var(--color-neutral-900); font-size: var(--fs-body); }
.kx-adm-permcheck__code { font-size: var(--fs-micro); color: var(--color-neutral-500); font-family: ui-monospace, monospace; }
.kx-adm-permcheck__desc { font-size: var(--fs-caption); color: var(--color-neutral-500); }

/* ── 공통코드 2단(그룹 → 코드) ── */
.kx-adm-codes { display: grid; grid-template-columns: 320px 1fr; gap: var(--space-4); align-items: start; }
.kx-adm-codes__groups { padding: 0; overflow: hidden; }
.kx-adm-codes__values { padding: 0; overflow: hidden; }
.kx-adm-codes__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: var(--border-card);
}
.kx-adm-codes__head h2 { font-size: var(--fs-h3); font-weight: var(--fw-bold); color: var(--color-neutral-900); }
/* 코드 값 KxDataTable 래퍼 — 카드 padding:0 을 상쇄(툴바·표·페이저 여백) */
.kx-adm-codes__tbl { padding: var(--space-3) var(--space-4) var(--space-4); }
.kx-adm-col-manage { text-align: right; }
.kx-adm-glist { list-style: none; margin: 0; padding: var(--space-2); display: flex; flex-direction: column; gap: 4px; }
.kx-adm-gitem {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3);
  border: 1px solid transparent;
  border-left: 4px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--color-white);
  cursor: pointer;
}
.kx-adm-gitem:hover { background: var(--color-neutral-050); }
.kx-adm-gitem.is-active { border-left-color: var(--color-primary-600); background: var(--color-primary-050); }
.kx-adm-gitem__name { font-weight: var(--fw-semibold); color: var(--color-neutral-900); }
.kx-adm-gitem__code { font-size: var(--fs-micro); color: var(--color-neutral-500); font-family: ui-monospace, monospace; }

/* ── 메뉴 트리 ── */
.kx-adm-menu__name { display: inline-flex; align-items: center; gap: 6px; }
.kx-adm-menu__depth { color: var(--color-neutral-200); font-family: ui-monospace, monospace; white-space: pre; }

/* ── 접근 거부(AdminGuard 403) ── */
.kx-adm-denied {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  padding: 64px var(--space-4);
  margin: 0 auto;
  max-width: 480px;
}
.kx-adm-denied__icon { color: var(--color-error); }
.kx-adm-denied__title { font-size: var(--fs-h1); font-weight: var(--fw-bold); color: var(--color-neutral-900); }
.kx-adm-denied__desc { font-size: var(--fs-body); color: var(--color-neutral-500); }
.kx-adm-denied__code { margin-top: var(--space-3); font-size: var(--fs-caption); font-family: ui-monospace, monospace; color: var(--color-neutral-400, #94a3b8); }

/* ── 반응형 ── */
@media (max-width: 1024px) {
  .kx-adm-filter__grid { grid-template-columns: 1fr 1fr; }
  .kx-adm-filter__actions { grid-column: 1 / -1; }
  .kx-adm-ruleset { grid-template-columns: 1fr; }
  .kx-adm-tenant { grid-template-columns: 1fr; }
  .kx-adm-add__grid { grid-template-columns: 1fr 1fr; }
  .kx-adm-matrix { grid-template-columns: 1fr; }
  .kx-adm-codes { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .kx-adm-filter__grid { grid-template-columns: 1fr; }
  .kx-adm-settings { grid-template-columns: 1fr; }
  .kx-adm-add__grid { grid-template-columns: 1fr; }
  .kx-adm-pager { flex-direction: column; align-items: stretch; }
  .kx-adm-modal__grid { grid-template-columns: 1fr; }
  .kx-adm-toolbar { flex-direction: column; align-items: stretch; }
}

/* ═══════════ W12 시스템관리 기본기(조직·프로그램·역할메뉴·인증정책·이력·상태·설정) ═══════════ */
/* 부서 트리 */
.kx-adm-tree { list-style: none; margin: 0; padding: var(--space-2) 0; display: grid; }
.kx-adm-tree__row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--color-neutral-100);
}
.kx-adm-tree__row:last-child { border-bottom: none; }
.kx-adm-tree__name { font-size: var(--fs-body); color: var(--color-neutral-900); }
.kx-adm-tree__actions { display: inline-flex; gap: var(--space-2); }

/* 시스템 상태 카드 */
.kx-adm-health-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); margin-bottom: var(--space-3);
}
.kx-adm-health-card {
  display: flex; flex-direction: column; gap: 4px; padding: var(--space-4);
  border-left: 4px solid var(--color-neutral-200);
}
.kx-adm-health-card--success { border-left-color: var(--color-success); }
.kx-adm-health-card--error { border-left-color: var(--color-error); }
.kx-adm-health-card--neutral { border-left-color: var(--color-warning); }
.kx-adm-health-card__label { font-size: var(--fs-caption); color: var(--color-neutral-500); }
.kx-adm-health-card__value { font-size: var(--fs-h2); font-weight: var(--fw-bold); color: var(--color-neutral-900); }
.kx-adm-health-card__sub { font-size: var(--fs-caption); color: var(--color-neutral-500); }
.kx-adm-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.kx-adm-metric { display: flex; flex-direction: column; gap: 4px; }
.kx-adm-metric__label { font-size: var(--fs-caption); color: var(--color-neutral-500); }
.kx-adm-metric__value { font-size: var(--fs-h3); font-weight: var(--fw-bold); color: var(--color-neutral-900); }
.kx-adm-metric__sub { font-size: var(--fs-caption); color: var(--color-neutral-500); }

/* 폼(인증정책·설정) */
.kx-adm-form { display: grid; gap: var(--space-3); }
.kx-adm-form__section {
  font-size: var(--fs-h3); font-weight: var(--fw-bold); color: var(--color-neutral-900);
  margin: var(--space-2) 0 0; padding-top: var(--space-2); border-top: 1px solid var(--color-neutral-100);
}
.kx-adm-form__section:first-child { border-top: none; padding-top: 0; }

/* 메일/알림 설정 */
.kx-adm-config-list { display: grid; gap: var(--space-3); }
.kx-adm-config-field {
  display: grid; grid-template-columns: 1fr 260px; gap: var(--space-3); align-items: center;
  padding-bottom: var(--space-2); border-bottom: 1px solid var(--color-neutral-100);
}
.kx-adm-config-field__key { display: flex; flex-direction: column; gap: 2px; }
.kx-adm-config-field__desc { font-size: var(--fs-caption); color: var(--color-neutral-500); }

.kx-adm-center { text-align: center; }

@media (max-width: 1024px) {
  .kx-adm-health-grid { grid-template-columns: 1fr; }
  .kx-adm-metrics { grid-template-columns: 1fr 1fr; }
  .kx-adm-config-field { grid-template-columns: 1fr; }
}
