/* ============================================================
   VTCC Admin Design System — 2026 라이트 리프레시
   공개 챗 위젯(chat-widget.css)과 같은 제품군: 바이올렛→인디고 그라디언트
   (#7C3AED → #4F46E5), 클린 뉴트럴 서피스, 레이어드 소프트 섀도.

   주의: 다른 admin 템플릿들이 아래 CSS 변수와 클래스명을 인라인
   스타일에서 직접 참조합니다. 변수/클래스 이름은 절대 변경하지 말 것.
   (값 튜닝은 허용, 추가는 자유)

   목차
     00. 프리로드/폰트 로딩 가드
     01. 디자인 토큰 (:root) + 다크 테마 자리([data-theme="dark"])
     02. 베이스 리셋 · 스크롤바 · 포커스 · 선택영역
     03. 레이아웃 셸 (.layout / .sidebar / .main / .adm-topbar / .adm-content)
     04. 사이드바 내비게이션 (+ collapsed)
     05. 레거시 공유 컴포넌트 (page-header, card, btn, form, table,
         tag, stats, alert, spinner, empty-state …) — 이름 유지, 값 재조정
     06. 공유 이름 보강 (modal-overlay, badge, pagination, form-hint,
         upload-area/zone, progress-bar) — 페이지 인라인 중복 삭제 가능
     07. adm-* 컴포넌트 라이브러리 (신규)
     08. 유틸리티
     09. 반응형
     10. 모션 감소
   ============================================================ */

/* ── 00. 프리로드 가드 ─────────────────────────────────────── */

/* 초기 로딩 시 트랜지션 비활성화 - 페이지 펼쳐지는 현상 방지 */
.preload,
.preload *,
.preload *::before,
.preload *::after,
.preload .sidebar,
.preload .main,
.preload .logo,
.preload .logo-text,
.preload .nav-menu a,
.preload .nav-bottom a {
    transition: none !important;
    animation: none !important;
}

/* 아이콘 폰트 로딩 전 숨김 - FOUT 방지 */
.fonts-loading [class^="ri-"],
.fonts-loading [class*=" ri-"] {
    visibility: hidden;
}

/* ── 01. 디자인 토큰 ───────────────────────────────────────── */

:root {
    color-scheme: light;

    /* ── 팔레트 (기존 토큰 이름 유지 — 라이트 테마 값으로 재조정) ── */
    --bg-primary: #f4f2fa;        /* 페이지 배경 */
    --bg-secondary: #fbfaff;      /* 사이드바/푸터 서피스 */
    --bg-card: #ffffff;           /* 카드 서피스 */
    --bg-hover: #f1eef9;          /* 호버 배경 */
    --accent: #7c3aed;            /* 브랜드 바이올렛 (위젯과 동일) */
    --accent-light: #8b5cf6;      /* 아이콘/보조 액센트 */
    --accent-glow: rgba(124, 58, 237, 0.16);
    --gradient-start: #7c3aed;
    --gradient-end: #4f46e5;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0284c7;
    --text-primary: #1d1a2e;
    --text-secondary: #494463;
    --text-muted: #726d8d;
    --border: #e3e0f0;

    /* ── 보조 토큰 (기존 이름 유지) ── */
    --bg-elevated: #ffffff;
    --accent-soft: rgba(124, 58, 237, 0.08);
    --border-soft: rgba(29, 26, 46, 0.08);
    --border-strong: #cdc9e2;
    --border-light: rgba(29, 26, 46, 0.05);
    --card-bg: #ffffff;
    --text: #1d1a2e;

    /* ── 신규 토큰 (2026 라이트 시스템) ── */
    --accent-strong: #6d28d9;                 /* 흰 배경 위 가독 바이올렛 텍스트 */
    --grad-accent: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
    --border-accent: rgba(124, 58, 237, 0.30);
    --success-soft: rgba(22, 163, 74, 0.09);
    --danger-soft: rgba(220, 38, 38, 0.08);
    --warning-soft: rgba(217, 119, 6, 0.10);
    --info-soft: rgba(2, 132, 199, 0.09);
    --success-text: #15803d;
    --danger-text: #b91c1c;
    --warning-text: #b45309;
    --info-text: #0369a1;
    --surface-sunken: #f8f7fc;                /* 테이블 헤더 등 살짝 가라앉은 면 */
    --ring: rgba(124, 58, 237, 0.35);
    --on-accent: #ffffff;                     /* 그라디언트/컬러 면 위 텍스트 (두 테마 공통) */

    /* Radius 스케일 */
    --radius-xs: 8px;
    --radius-sm: 10px;
    --radius-md: 12px;
    --radius: 14px;
    --radius-lg: 18px;
    --radius-full: 999px;

    /* Shadow 스케일 (라이트용 바이올렛 틴트 레이어드 섀도) */
    --shadow-xs: 0 1px 2px rgba(23, 15, 60, 0.05);
    --shadow-sm: 0 1px 2px rgba(23, 15, 60, 0.04), 0 2px 8px rgba(23, 15, 60, 0.05);
    --shadow-md: 0 2px 6px rgba(23, 15, 60, 0.05), 0 8px 24px rgba(23, 15, 60, 0.08);
    --shadow-lg: 0 8px 18px rgba(23, 15, 60, 0.09), 0 24px 56px rgba(23, 15, 60, 0.13);
    --shadow-accent: 0 4px 14px rgba(124, 58, 237, 0.28);

    /* Spacing 스케일 */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    /* 모션 */
    --transition-fast: 0.15s ease;
    --transition: 0.2s ease;

    /* 타이포그래피 (CDN 폰트 없이 시스템 스택만 사용) */
    --font-sans: 'Inter', 'Pretendard Variable', Pretendard, -apple-system,
        BlinkMacSystemFont, 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR',
        'Malgun Gothic', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 다크 테마 진입점: <html data-theme="dark"> 만 붙이면 전환되도록
   핵심 서피스/텍스트/보더 토큰을 재정의해 둠 (현재는 어디서도 미사용). */
[data-theme="dark"] {
    color-scheme: dark;
    --bg-primary: #0c0d13;
    --bg-secondary: #13141c;
    --bg-card: #181a23;
    --bg-hover: #20222e;
    --bg-elevated: #1f2230;
    --card-bg: #181a23;
    --text-primary: #f4f5fb;
    --text-secondary: #c8cbd9;
    --text-muted: #a3a9bf;
    --text: #f4f5fb;
    --border: #2a2d3a;
    --border-soft: rgba(160, 165, 205, 0.12);
    --border-strong: #3a3e50;
    --border-light: rgba(255, 255, 255, 0.07);
    --accent: #a78bfa;
    --accent-light: #c4b5fd;
    --accent-strong: #c4b5fd;
    --accent-soft: rgba(124, 108, 255, 0.14);
    --accent-glow: rgba(124, 108, 255, 0.28);
    --accent-border: rgba(167, 139, 250, 0.40);
    --border-accent: rgba(167, 139, 250, 0.40);
    --surface-sunken: rgba(255, 255, 255, 0.035);
    --ring: rgba(167, 139, 250, 0.55);

    /* 시맨틱 컬러: 다크 배경에서 가독성 확보 (밝은 텍스트 + 더 진한 소프트 면) */
    --success: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;
    --info: #38bdf8;
    --success-text: #6ee7b7;
    --danger-text: #fca5a5;
    --warning-text: #fcd34d;
    --info-text: #7dd3fc;
    --success-soft: rgba(52, 211, 153, 0.14);
    --danger-soft: rgba(248, 113, 113, 0.14);
    --warning-soft: rgba(251, 191, 36, 0.14);
    --info-soft: rgba(56, 189, 248, 0.14);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.32);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30), 0 2px 8px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.26), 0 8px 24px rgba(0, 0, 0, 0.32);
    --shadow-lg: 0 8px 18px rgba(0, 0, 0, 0.34), 0 24px 56px rgba(0, 0, 0, 0.48);
    --shadow-accent: 0 4px 14px rgba(124, 108, 255, 0.40);
}

/* 다크 테마: 앰비언트 배경 글로우를 어둡게 + 스켈레톤/스크롤바 톤 보정 */
[data-theme="dark"] body {
    background:
        radial-gradient(1100px 600px at 88% -12%, rgba(124, 108, 255, 0.10), transparent 55%),
        radial-gradient(900px 620px at -8% 112%, rgba(79, 70, 229, 0.10), transparent 60%),
        var(--bg-primary);
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.04) 25%,
        rgba(255, 255, 255, 0.08) 37%,
        rgba(255, 255, 255, 0.04) 63%);
    background-size: 400% 100%;
}

[data-theme="dark"] html {
    scrollbar-color: rgba(167, 139, 250, 0.45) transparent;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(167, 139, 250, 0.32);
    background-clip: padding-box;
}

/* 탑바 프로스티드 글래스: 라이트 하드코딩 → 다크 서피스로 보정 */
[data-theme="dark"] .adm-topbar {
    background: rgba(19, 20, 28, 0.78);
}

[data-theme="dark"] .mobile-menu-btn {
    background: var(--bg-card);
}

/* ── 02. 베이스 ────────────────────────────────────────────── */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scrollbar-width: thin;
    scrollbar-color: rgba(124, 58, 237, 0.35) transparent;
}

body {
    font-family: var(--font-sans);
    /* 앰비언트 라이트 배경: 위젯과 같은 라디얼 글로우(아주 옅게) */
    background:
        radial-gradient(1100px 600px at 88% -12%, rgba(124, 58, 237, 0.07), transparent 55%),
        radial-gradient(900px 620px at -8% 112%, rgba(79, 70, 229, 0.06), transparent 60%),
        var(--bg-primary);
    background-attachment: fixed;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: rgba(124, 58, 237, 0.18);
}

/* 네이티브 체크박스/라디오 브랜드 컬러 */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent);
}

/* ── 스크롤바 (WebKit) ── */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.28);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 58, 237, 0.45);
    background-clip: padding-box;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* ── 키보드 포커스 링 ── */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* 네이티브 체크박스·라디오 키보드 포커스 링 (.adm-switch 외 raw 컨트롤용) */
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ── 03. 레이아웃 셸 ───────────────────────────────────────── */

.layout {
    display: flex;
    min-height: 100vh;
}

/* 사이드바 */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-right: 1px solid var(--border-soft);
    box-shadow: 4px 0 24px rgba(23, 15, 60, 0.03);
    padding: 24px 16px;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, padding 0.3s ease;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 200;
}

/* 메인 (패딩은 .adm-content가 담당 — 콘텐츠 컨테이너 일원화) */
.main {
    flex: 1;
    margin-left: 260px;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.main.sidebar-collapsed {
    margin-left: 72px;
}

/* 탑바: 페이지 타이틀 + 사용자/로그아웃 (base.html 전용 크롬) */
.adm-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    padding: 12px 32px;
    background: rgba(251, 250, 255, 0.84);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    backdrop-filter: blur(14px) saturate(160%);
    border-bottom: 1px solid var(--border-soft);
}

.adm-topbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adm-topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.adm-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-xs);
    font-size: 0.84rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.adm-user-chip i {
    color: var(--accent);
    font-size: 1rem;
}

.adm-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.15rem;
    transition: background var(--transition), color var(--transition);
}

.adm-logout-btn:hover {
    background: var(--danger-soft);
    color: var(--danger-text);
}

/* 라이트/다크 테마 토글 버튼 */
.adm-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    box-shadow: var(--shadow-xs);
    color: var(--text-secondary);
    font-size: 1.15rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.adm-theme-toggle:hover {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--border-accent);
}

/* 콘텐츠 컨테이너: max-width + 일관 패딩 (페이지 콘텐츠가 들어가는 곳) */
.adm-content {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 32px 48px;
    flex: 1;
}

/* embed 모드(허브 iframe 내부): 셸 없이 본문만 — 가운데 정렬/넓은 패딩 제거 */
body.embed .adm-content {
    max-width: none;
    padding: 18px 20px 28px;
}

/* ── 04. 사이드바 내비게이션 ───────────────────────────────── */

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px 24px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 16px;
    transition: gap 0.3s ease, padding 0.3s ease;
    flex-shrink: 0;
    text-decoration: none;
    color: inherit;
}

.logo-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    flex-shrink: 0;
    background: var(--grad-accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.logo-text {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.2s ease, width 0.3s ease;
}

.logo-text span {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: block;
}

.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-menu li {
    margin-bottom: 3px;
}

/* 내비 그룹 라벨 (base.html 그룹핑용 — 접힘 시 구분선으로 변형) */
.nav-group-label {
    list-style: none;
    padding: 18px 14px 7px;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
}

.nav-menu li.nav-group-label:first-child {
    padding-top: 4px;
}

.nav-menu a,
.nav-bottom a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease,
        gap 0.3s ease, padding 0.3s ease;
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
}

.nav-menu a span,
.nav-bottom a span {
    opacity: 1;
    transition: opacity 0.15s ease, width 0.3s ease;
    overflow: hidden;
    white-space: nowrap;
}

.nav-menu a:hover,
.nav-bottom a:hover {
    background: var(--accent-soft);
    color: var(--text-primary);
}

.nav-menu a.active,
.nav-bottom a.active {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.10), rgba(79, 70, 229, 0.07));
    color: var(--accent-strong);
    font-weight: 600;
    box-shadow: inset 2.5px 0 0 var(--accent);
}

.nav-menu a.active i,
.nav-bottom a.active i {
    color: var(--accent);
}

.nav-menu i,
.nav-bottom i {
    font-size: 1.2rem;
    width: 24px;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.nav-menu a:hover i,
.nav-menu a.active i,
.nav-bottom a:hover i,
.nav-bottom a.active i {
    color: inherit;
}

.nav-bottom {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
    flex-shrink: 0;
}

/* 사용자 정보 섹션 */
.user-section {
    border-top: 1px solid var(--border-soft);
    margin-top: 12px;
    padding-top: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.admin-badge {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border: 1px solid rgba(124, 58, 237, 0.22);
    padding: 2px 9px;
    border-radius: var(--radius-full);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.logout-link {
    color: var(--danger);
}

.nav-bottom .logout-link:hover {
    background: var(--danger-soft);
    color: var(--danger-text);
}

/* 모바일 메뉴 버튼 */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 16px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), border-color var(--transition);
}

.mobile-menu-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

/* 오버레이 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(23, 16, 49, 0.42);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 999;
}

/* 사이드바 접기/펼치기 토글 버튼 */
#sidebarToggle {
    position: fixed;
    left: 260px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 60px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-left: none;
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: left 0.3s ease, background 0.2s ease, width 0.2s ease, color 0.2s ease;
    z-index: 1001;
}

#sidebarToggle:hover {
    background: var(--bg-hover);
    color: var(--accent-strong);
    width: 24px;
}

#sidebarToggle i {
    transition: transform 0.3s ease;
}

/* 접힌 상태 */
.sidebar.collapsed {
    width: 72px;
    padding: 16px 8px;
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .logo {
    padding: 0;
    padding-bottom: 16px;
    margin-bottom: 16px;
    justify-content: center;
    gap: 0;
}

.sidebar.collapsed .logo-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    flex-shrink: 0;
}

.sidebar.collapsed .nav-menu {
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.collapsed .nav-menu li {
    margin-bottom: 2px;
}

/* 접힘 시 그룹 라벨 → 얇은 구분선 */
.sidebar.collapsed .nav-group-label {
    height: 1px;
    padding: 0;
    margin: 10px 10px;
    background: var(--border-soft);
    font-size: 0;
}

.sidebar.collapsed .nav-menu a,
.sidebar.collapsed .nav-bottom a {
    justify-content: center;
    padding: 10px 8px;
    gap: 0;
}

.sidebar.collapsed .nav-menu a span,
.sidebar.collapsed .nav-bottom a span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-menu i,
.sidebar.collapsed .nav-bottom i {
    margin: 0;
    width: auto;
    text-align: center;
}

/* 접힌 상태 - 사용자 정보 영역 */
.sidebar.collapsed .nav-bottom {
    padding-top: 12px;
}

.sidebar.collapsed .user-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sidebar.collapsed .user-info {
    justify-content: center;
    padding: 8px;
    gap: 0;
}

.sidebar.collapsed .user-info span {
    display: none;
}

.sidebar.collapsed .user-info i {
    margin: 0;
}

.sidebar.collapsed .logout-link {
    justify-content: center;
    padding: 10px 8px;
}

/* ── 05. 레거시 공유 컴포넌트 (이름 유지, 라이트 재조정) ───── */

.page-header {
    margin-bottom: 28px;
}

.page-header h1,
.page-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header h1 i,
.page-header h2 i {
    font-size: 1.45rem;
    color: var(--accent);
    -webkit-text-fill-color: var(--accent);
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-top: 4px;
}

/* 카드 */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
    border-color: var(--border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--accent);
}

/* 버튼 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    transition: background var(--transition), color var(--transition),
        border-color var(--transition), box-shadow var(--transition),
        transform var(--transition-fast);
    text-decoration: none;
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--grad-accent);
    color: white;
    box-shadow: var(--shadow-accent), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.24);
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

.btn-dark {
    background: #211d35;
    color: #ffffff;
    border: 1px solid #211d35;
}

.btn-dark:hover {
    background: #332d4e;
    border-color: #332d4e;
}

.btn-success {
    background: linear-gradient(159deg, #0ea371 0%, #34d399 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28);
}

.btn-success:hover {
    background: linear-gradient(159deg, #10b981 0%, #4ade9f 100%);
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(159deg, #d97706 0%, #f59e0b 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.26);
}

.btn-warning:hover {
    background: linear-gradient(159deg, #ea8a0c 0%, #fbbf24 100%);
    transform: translateY(-1px);
}

.btn-info {
    background: linear-gradient(159deg, #1d4ed8 0%, #0ea5e9 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.26);
}

.btn-info:hover {
    background: linear-gradient(159deg, #2563eb 0%, #38bdf8 100%);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-xs);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
}

/* 아이콘 전용 버튼 (터치 타깃 ≥ 38px) */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
    padding: 8px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-icon:hover {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: rgba(124, 58, 237, 0.18);
}

/* 폼 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    height: 40px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.92rem;
    transition: border-color var(--transition), box-shadow var(--transition),
        background var(--transition);
}

.form-control:hover {
    border-color: var(--border-strong);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    padding: 0 12px;
    line-height: 38px;
    cursor: pointer;
}

textarea.form-control {
    min-height: 180px;
    resize: vertical;
    line-height: 1.7;
    height: auto;
}

/* 헬퍼 텍스트 (chat_logs 등에서 사용) */
.form-hint,
.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* 테이블 */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    vertical-align: middle;
}

.table th {
    background: var(--surface-sunken);
    font-weight: 600;
    font-size: 0.74rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
}

.table th:first-child {
    border-top-left-radius: var(--radius-sm);
}

.table th:last-child {
    border-top-right-radius: var(--radius-sm);
}

.table td {
    border-bottom: 1px solid var(--border-soft);
    font-size: 0.9rem;
}

.table tr:hover td {
    background: rgba(124, 58, 237, 0.045);
}

.table .actions {
    text-align: center;
    vertical-align: middle;
}

.table .actions .btn {
    margin: 0 4px;
}

/* 태그 */
.tag {
    display: inline-block;
    padding: 3px 10px;
    background: var(--accent-soft);
    border: 1px solid rgba(124, 58, 237, 0.18);
    border-radius: var(--radius-full);
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--accent-strong);
    margin: 2px;
}

/* 통계 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--grad-accent);
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-soft);
    border: 1px solid rgba(124, 58, 237, 0.16);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 16px;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}

/* 긴 숫자 자동 크기 조절 */
.stat-value.auto-fit {
    font-size: clamp(1rem, 5vw, 2.25rem);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* 알림 */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.92rem;
}

.alert-success {
    background: var(--success-soft);
    border: 1px solid rgba(22, 163, 74, 0.30);
    color: var(--success-text);
}

.alert-error {
    background: var(--danger-soft);
    border: 1px solid rgba(220, 38, 38, 0.30);
    color: var(--danger-text);
}

.alert-warning {
    background: var(--warning-soft);
    border: 1px solid rgba(217, 119, 6, 0.30);
    color: var(--warning-text);
}

.alert-info {
    background: var(--info-soft);
    border: 1px solid rgba(2, 132, 199, 0.30);
    color: var(--info-text);
}

/* 로딩 */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: -3px;
}

.spinner-sm {
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

/* 스켈레톤 로딩 */
.skeleton {
    background: linear-gradient(90deg,
        #ece9f6 25%,
        #f7f5fc 37%,
        #ece9f6 63%);
    background-size: 400% 100%;
    border-radius: var(--radius-xs);
    animation: skeleton-shimmer 1.4s ease infinite;
}

@keyframes skeleton-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.35;
    color: var(--accent);
}

.empty-state p {
    margin-bottom: 20px;
}

/* ── 06. 공유 이름 보강 (페이지 인라인 중복 삭제 가능) ─────── */

/* 모달: 페이지들이 inline style="display:none" + JS style.display='flex'
   패턴을 사용 → 베이스는 display:flex 유지 (기존 동작과 호환) */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(23, 16, 49, 0.45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.modal-content {
    width: 100%;
    max-width: 640px;
    max-height: 86vh;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    animation: adm-pop 0.18s ease-out;
}

.modal-sm {
    max-width: 420px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-body {
    font-size: 0.92rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

@keyframes adm-pop {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

/* 배지 (.badge — knowledge_list/ai_training 공유, .adm-badge 와 동일 레시피) */
.badge,
.adm-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    background: var(--accent-soft);
    color: var(--accent-strong);
    border: 1px solid rgba(124, 58, 237, 0.18);
}

.badge-success,
.adm-badge.success {
    background: var(--success-soft);
    color: var(--success-text);
    border-color: rgba(22, 163, 74, 0.25);
}

.badge-warning,
.adm-badge.warning {
    background: var(--warning-soft);
    color: var(--warning-text);
    border-color: rgba(217, 119, 6, 0.25);
}

.badge-danger,
.adm-badge.danger {
    background: var(--danger-soft);
    color: var(--danger-text);
    border-color: rgba(220, 38, 38, 0.25);
}

.badge-info,
.adm-badge.info {
    background: var(--info-soft);
    color: var(--info-text);
    border-color: rgba(2, 132, 199, 0.25);
}

.badge-neutral,
.adm-badge.neutral {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border-color: var(--border-soft);
}

/* 앞에 상태 점 찍는 변형: <span class="adm-badge success dot">…</span> */
.adm-badge.dot::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* 페이지네이션 컨테이너 (ai_training 등 .pagination 공유) */
.pagination,
.adm-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 20px;
}

/* 업로드 드롭존 (.upload-area / .upload-zone — file_import, chat_import 공유) */
.adm-dropzone,
.upload-area,
.upload-zone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-card);
    padding: 40px 24px;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.adm-dropzone:hover,
.upload-area:hover,
.upload-zone:hover,
.adm-dropzone.dragover,
.adm-dropzone.drag-over,
.upload-area.dragover,
.upload-area.drag-over,
.upload-zone.dragover,
.upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.adm-dropzone-icon {
    display: block;
    font-size: 2.4rem;
    color: var(--accent);
    margin-bottom: 10px;
    line-height: 1;
}

.adm-dropzone-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* 진행 바 (.progress-bar — file_import 공유) */
.adm-progress,
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.adm-progress-fill,
.progress-bar-fill {
    height: 100%;
    width: 0;
    background: var(--grad-accent);
    border-radius: inherit;
    transition: width 0.3s ease;
}

.adm-progress.success .adm-progress-fill { background: var(--success); }
.adm-progress.danger .adm-progress-fill { background: var(--danger); }

/* ── 07. adm-* 컴포넌트 라이브러리 ─────────────────────────── */

/* 페이지 헤더: 타이틀(+아이콘 타일) / 설명 / 우측 액션 */
.adm-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
}

.adm-page-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--text-primary);
}

.adm-page-title i {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid rgba(124, 58, 237, 0.14);
    border-radius: var(--radius-md);
}

.adm-page-sub {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-top: 4px;
}

.adm-page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* 카드 */
.adm-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.adm-card.hoverable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}

.adm-card.is-flush {
    padding: 0;
    overflow: hidden;
}

.adm-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.adm-card.is-flush .adm-card-header {
    padding: 18px 22px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border-soft);
}

.adm-card-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.adm-card-title i {
    color: var(--accent);
}

.adm-card-body {
    font-size: 0.92rem;
}

.adm-card.is-flush .adm-card-body {
    padding: 20px 22px;
}

.adm-card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
}

.adm-card.is-flush .adm-card-footer {
    margin-top: 0;
    padding: 14px 22px;
    background: var(--bg-secondary);
}

/* 통계 카드 (틴트 변형: .accent(기본)/.success/.warning/.danger/.info) */
.adm-stat {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.adm-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}

.adm-stat-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
    color: var(--accent);
}

.adm-stat.success .adm-stat-icon { background: var(--success-soft); color: var(--success); }
.adm-stat.warning .adm-stat-icon { background: var(--warning-soft); color: var(--warning); }
.adm-stat.danger .adm-stat-icon { background: var(--danger-soft); color: var(--danger); }
.adm-stat.info .adm-stat-icon { background: var(--info-soft); color: var(--info); }

.adm-stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adm-stat-label {
    font-size: 0.84rem;
    color: var(--text-muted);
}

.adm-stat-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
}

.adm-stat-delta.up { color: var(--success-text); }
.adm-stat-delta.down { color: var(--danger-text); }

/* 그리드 헬퍼 */
.adm-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 24px;
}

.adm-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.adm-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.adm-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.adm-grid.auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* 툴바: 버튼/검색 등 가로 배치 (카드 위·아래 어디든) */
.adm-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.adm-spacer {
    flex: 1;
}

/* 필터 바: 카드형 검색 + 셀렉트 + 액션 행 */
.adm-filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    margin-bottom: 20px;
}

/* 아이콘 인셋 검색 필드: <div class="adm-search"><i class="ri-search-line"></i><input class="form-control"></div> */
.adm-search {
    position: relative;
    flex: 1;
    min-width: 220px;
}

.adm-search > i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}

.adm-search .form-control,
.adm-search input {
    padding-left: 38px;
}

/* 라벨+컨트롤 인라인 필드 */
.adm-field {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.adm-field .form-control {
    width: auto;
    min-width: 130px;
}

/* 필터 칩 (적용된 필터 표시 + 제거 버튼) */
.adm-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 12px;
    background: var(--accent-soft);
    border: 1px solid rgba(124, 58, 237, 0.20);
    border-radius: var(--radius-full);
    color: var(--accent-strong);
    font-size: 0.8rem;
    font-weight: 500;
}

.adm-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background var(--transition-fast);
}

.adm-chip-remove:hover {
    background: rgba(124, 58, 237, 0.18);
}

/* 데이터 테이블 (래퍼가 보더/라운드/스크롤 담당) */
.adm-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    overflow-x: auto;
    margin-bottom: 24px;
}

.adm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.adm-table th {
    padding: 11px 16px;
    background: var(--surface-sunken);
    text-align: left;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
}

.adm-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}

.adm-table tbody tr {
    transition: background var(--transition-fast);
}

.adm-table tbody tr:hover {
    background: rgba(124, 58, 237, 0.04);
}

.adm-table tbody tr:last-child td {
    border-bottom: none;
}

.adm-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.adm-table .actions {
    text-align: right;
    white-space: nowrap;
}

/* 스크롤 시 헤더 고정: <table class="adm-table sticky"> (래퍼에 max-height 지정) */
.adm-table.sticky th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* 카드 내부 플러시 테이블 조합 */
.adm-card.is-flush .adm-table-wrap {
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
}

/* 탭 (밑줄형 기본 / .pills 세그먼트형) */
.adm-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 20px;
    overflow-x: auto;
}

.adm-tab {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    margin-bottom: -1px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.adm-tab:hover {
    color: var(--text-primary);
}

.adm-tab.active {
    color: var(--accent-strong);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.adm-tabs.pills {
    border-bottom: none;
    background: var(--bg-hover);
    padding: 4px;
    border-radius: var(--radius-sm);
    width: max-content;
    max-width: 100%;
}

.adm-tabs.pills .adm-tab {
    border: none;
    margin: 0;
    padding: 8px 14px;
    border-radius: var(--radius-xs);
}

.adm-tabs.pills .adm-tab.active {
    background: var(--bg-card);
    box-shadow: var(--shadow-xs);
}

/* 페이지네이션 버튼 */
.adm-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xs);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition),
        background var(--transition), box-shadow var(--transition);
}

.adm-page-btn:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
}

.adm-page-btn.active {
    background: var(--grad-accent);
    border-color: transparent;
    color: #ffffff;
    font-weight: 600;
    box-shadow: var(--shadow-accent);
}

.adm-page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* 알림 (.adm-alert + 시맨틱 변형, .adm-toast 로 플로팅) */
.adm-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.adm-alert > i {
    font-size: 1.1rem;
    line-height: 1.5;
    flex-shrink: 0;
}

.adm-alert-title {
    font-weight: 700;
    display: block;
    margin-bottom: 2px;
}

.adm-alert.success {
    background: var(--success-soft);
    border-color: rgba(22, 163, 74, 0.30);
    color: var(--success-text);
}

.adm-alert.danger {
    background: var(--danger-soft);
    border-color: rgba(220, 38, 38, 0.30);
    color: var(--danger-text);
}

.adm-alert.warning {
    background: var(--warning-soft);
    border-color: rgba(217, 119, 6, 0.30);
    color: var(--warning-text);
}

.adm-alert.info {
    background: var(--info-soft);
    border-color: rgba(2, 132, 199, 0.30);
    color: var(--info-text);
}

/* 토스트: .adm-alert 에 .adm-toast 추가 (우상단 고정 + 슬라이드 인) */
.adm-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1300;
    min-width: 280px;
    max-width: 420px;
    margin: 0;
    box-shadow: var(--shadow-lg);
    animation: adm-toast-in 0.25s ease-out;
}

@keyframes adm-toast-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: none; }
}

/* 모달 (신규 마크업용: 기본 숨김, .open 으로 표시) */
.adm-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(23, 16, 49, 0.45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.adm-modal.open {
    display: flex;
}

.adm-modal-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 560px;
    max-height: 86vh;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: adm-pop 0.18s ease-out;
}

.adm-modal-panel.sm { max-width: 420px; }
.adm-modal-panel.lg { max-width: 840px; }

.adm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.adm-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.adm-modal-title i {
    color: var(--accent);
}

.adm-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.adm-modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.adm-modal-body {
    padding: 20px 22px;
    overflow-y: auto;
    font-size: 0.92rem;
}

.adm-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--border-soft);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

/* 빈 상태 (아이콘 타일 + 타이틀 + 설명 + 액션) */
.adm-empty {
    text-align: center;
    padding: 56px 20px;
    color: var(--text-muted);
}

.adm-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: var(--radius-lg);
}

.adm-empty-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.adm-empty-desc {
    font-size: 0.88rem;
    margin-bottom: 18px;
}

/* 토글 스위치: <label class="adm-switch"><input type="checkbox"><span class="adm-switch-slider"></span> 라벨</label> */
.adm-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    user-select: none;
}

/* .form-group label { display:block } (스코프 우선순위 0,1,1)이 토글 라벨을
   block 으로 덮어써 슬라이더가 0폭이 되고 knob 이 텍스트에 겹치던 문제 방지.
   .form-group 안에서도 토글이 정상 동작하도록 우선순위를 보강한다. */
.form-group label.adm-switch {
    display: inline-flex;
    margin-bottom: 0;
    font-weight: 400;
}

.adm-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.adm-switch-slider {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
    background: var(--border-strong);
    border-radius: var(--radius-full);
    box-shadow: inset 0 0 0 1px rgba(29, 26, 46, 0.12);
    transition: background var(--transition);
}

/* 다크 모드: 오프 트랙이 카드 배경과 묻히지 않도록 또렷한 색 + 흰 링 */
[data-theme="dark"] .adm-switch-slider {
    background: #525a73;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.adm-switch-slider::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(23, 15, 60, 0.30);
    transition: transform var(--transition);
}

.adm-switch input:checked + .adm-switch-slider {
    background: var(--grad-accent);
}

.adm-switch input:checked + .adm-switch-slider::after {
    transform: translateX(18px);
}

.adm-switch input:focus-visible + .adm-switch-slider {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.adm-switch input:disabled + .adm-switch-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── 08. 유틸리티 ──────────────────────────────────────────── */

/* 접근성: 시각적으로 숨기되 스크린리더에는 노출 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.adm-muted {
    color: var(--text-muted);
}

.adm-flex {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* 버튼 행: 여러 버튼 가로 배치 + 좁은 화면 자동 줄바꿈 (페이지 인라인 flex-wrap 수렴) */
.btn-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* 전체폭 버튼 (로그인 등) */
.btn-block {
    width: 100%;
    justify-content: center;
}

/* 입력 + 우측 액션 버튼 행 (예: API 키 + 연결 테스트) */
.input-with-action {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.input-with-action > .form-control {
    flex: 1;
    min-width: 0;
}

.input-with-action > .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .input-with-action {
        flex-wrap: wrap;
    }
    .input-with-action > .btn {
        width: 100%;
        justify-content: center;
    }
}

.adm-divider {
    height: 1px;
    border: none;
    background: var(--border-soft);
    margin: 20px 0;
}

/* ── 09. 반응형 ────────────────────────────────────────────── */

@media (max-width: 1100px) {
    .adm-grid.cols-4,
    .adm-grid.cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 태블릿 */
@media (max-width: 992px) {
    .sidebar {
        width: 220px;
    }
    #sidebarToggle {
        left: 220px;
    }
    .sidebar.collapsed + #sidebarToggle,
    .sidebar.collapsed ~ #sidebarToggle {
        left: 72px;
    }
    .main {
        margin-left: 220px;
    }
    .main.sidebar-collapsed {
        margin-left: 72px;
    }
    .adm-topbar {
        padding: 12px 24px;
    }
    .adm-content {
        padding: 24px 24px 40px;
    }
}

/* 모바일 */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
        width: 280px;
        transition: transform 0.3s ease;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .sidebar-overlay.open {
        display: block;
    }

    /* 모바일에서 토글 버튼 숨기기 */
    #sidebarToggle {
        display: none;
    }

    .main {
        margin-left: 0;
    }

    .main.sidebar-collapsed {
        margin-left: 0;
    }

    /* 햄버거 버튼(고정, 좌측 16px·44px)을 피해 타이틀 배치 */
    .adm-topbar {
        min-height: 60px;
        padding: 10px 16px 10px 72px;
    }

    .adm-content {
        padding: 20px 16px 36px;
    }

    .page-header {
        margin-bottom: 20px;
    }

    .page-header h1, .page-header h2 {
        font-size: 1.4rem;
        gap: 8px;
    }

    .page-header h1 i, .page-header h2 i {
        font-size: 1.2rem;
    }

    .page-header p {
        font-size: 0.85rem;
    }

    .adm-page-title {
        font-size: 1.3rem;
    }

    .adm-page-title i {
        width: 38px;
        height: 38px;
        font-size: 1.15rem;
    }

    .card,
    .adm-card {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .adm-grid.cols-2,
    .adm-grid.cols-3,
    .adm-grid.cols-4 {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .adm-filter-bar {
        padding: 12px;
    }

    .adm-table th,
    .adm-table td {
        padding: 10px 12px;
    }

    .modal-content,
    .adm-modal-panel {
        max-height: 92vh;
    }
}

/* 작은 모바일 */
@media (max-width: 480px) {
    .adm-content {
        padding: 16px 12px 28px;
    }

    .adm-topbar {
        gap: 10px;
    }

    .adm-user-chip {
        padding: 6px 10px;
    }

    .card,
    .adm-card {
        padding: 12px;
        border-radius: var(--radius-sm);
    }

    .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .form-control {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .modal-content {
        padding: 16px;
    }
}

/* ── 10. 모션 최소화 환경 지원 ─────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}
