/*
 * Payvit Admin Page Styles
 * 관리자 페이지 공통 CSS — header.jsp 에서 로드
 *
 * shadcn/ui 디자인 토큰(payvit-tokens.css) 기반으로 관리자 UI 컴포넌트 정의.
 * 기존 header.jsp 인라인 스타일을 외부 CSS 로 분리.
 *
 * 2026-10-19 Paper 테마 — 마케팅 사이트 / 개발자 가이드(guide.css)와 같은 톤으로 통일.
 *  - 종이색 바탕 + 먹색 글씨 + 핑크(#e94560)는 포인트(활성 메뉴 표시·탭 밑줄·로고)로만
 *  - 주 버튼은 먹색. 한 화면에 먹색 주 버튼 하나가 원칙
 *  - 카드/패널은 그림자 대신 얇은 선으로 구분
 *  - 이 파일은 admin / dashboard 만 로드함 → 결제창(pay/*)은 영향 없음.
 *    그래서 payvit-tokens.css 원본 값은 그대로 두고, 여기 :root 에서 값만 다시 정의한다.
 */

/* ===== Paper 테마 토큰 (admin / dashboard 전용 재정의) ===== */
:root {
    /* 먹색 — 주 버튼·제목. 다크 모드에서는 반전 */
    --ink: #161513;
    --ink-hover: #2e2c29;
    --ink-contrast: #ffffff;

    /* 값은 마케팅 사이트(payvit-homepage assets/css) 토큰과 맞춤: surface-0/1, ink-*, brand-* */
    --background: #fbfaf7;               /* 페이지 — 종이색 (홈페이지 --surface-0) */
    --foreground: #161513;
    --card: #ffffff;                     /* 카드는 순백 — 종이 위에 한 장 얹은 느낌 */
    --card-foreground: #161513;
    --surface-2: #fbfaf8;                /* 카드 안 보조 면 (표 헤더·지표 칸) — 카드보다 살짝 어둡게 */
    --muted: #f3f1ec;                    /* 비활성 면 · 표 hover */
    --muted-foreground: #5a5650;         /* 보조 텍스트 1단계 */
    --muted-foreground-2: #8a857c;       /* 2단계 — placeholder, hint */
    --muted-foreground-3: #b4afa6;       /* 3단계 — 비활성 */
    --accent: #f3f1ec;
    --accent-foreground: #161513;

    --border: #e2ded6;                   /* 홈페이지 --ink-200 */
    --border-light: #edeae4;             /* 홈페이지 --ink-100 */
    --input: #dcd8cf;
    --ring: #161513;

    --brand-primary-light: #fcf0f1;
    --brand-ink: #c12d4a;                /* 핑크 글자 (흰 바탕 대비 확보용) */

    /* 상태색 — 채도 낮춰 종이 톤에 맞춤 */
    --success: #1f8a5b;                  /* 홈페이지 --success */
    --success-light: #e7f2eb;
    --success-foreground: #156b45;
    --warning: #d98a1f;                  /* 홈페이지 --warning */
    --warning-light: #fbf1df;
    --warning-foreground: #9a5b00;
    --danger: #d14343;                   /* 홈페이지 --danger */
    --danger-light: #fcedec;
    --danger-foreground: #b3302d;
    --info: #2f5fa8;                     /* 홈페이지 --accent-blue */
    --info-light: #e9eef5;
    --info-foreground: #2f5fa8;

    /* 사이드바 — 밝은 종이색 (홈페이지 --surface-1) */
    --admin-sidebar: #f4f2ed;
    --admin-sidebar-hover: #ebe8e1;
    --admin-sidebar-active: #ffffff;

    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    --shadow-sm: 0 1px 2px rgba(22, 21, 19, 0.04);
    --shadow-md: 0 2px 8px rgba(22, 21, 19, 0.06);
    --shadow-lg: 0 12px 32px -8px rgba(22, 21, 19, 0.14), 0 2px 6px rgba(22, 21, 19, 0.04);
    --shadow-xl: 0 28px 56px -16px rgba(22, 21, 19, 0.24), 0 4px 12px rgba(22, 21, 19, 0.05);
    --shadow-brand: 0 6px 18px -6px rgba(22, 21, 19, 0.35);

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

    /* Bootstrap 기본값을 Paper 톤으로 — 클래스별 덮어쓰기 없이 일괄 반영되는 것들 */
    --bs-body-font-family: var(--font-sans);
    --bs-body-color: var(--foreground);
    --bs-body-bg: var(--background);
    --bs-border-color: var(--border);
    --bs-secondary-color: var(--muted-foreground);
    --bs-tertiary-bg: var(--muted);
    --bs-link-color: var(--foreground);
    --bs-link-color-rgb: 22, 21, 19;
    --bs-link-hover-color: var(--brand-ink);
    --bs-link-hover-color-rgb: 193, 45, 74;
    --bs-primary-rgb: 22, 21, 19;
    --bs-success-rgb: 23, 116, 75;
    --bs-danger-rgb: 179, 48, 45;
    --bs-warning-rgb: 154, 91, 0;
    --bs-info-rgb: 44, 85, 168;
    --bs-secondary-rgb: 90, 86, 80;
    --bs-focus-ring-color: rgba(22, 21, 19, 0.12);
    --bs-code-color: var(--brand-ink);   /* Bootstrap 기본 자홍색(#d63384) 대신 브랜드 핑크 글자 */
}

/* ===== Base ===== */
body {
    background: var(--background);
    margin: 0; padding: 0;
    font-family: var(--font-sans);
    color: var(--foreground);
    letter-spacing: -0.01em;
    word-break: keep-all;
    -webkit-font-smoothing: antialiased;
}
::selection { background: var(--ink); color: var(--ink-contrast); }

/* ===== Admin 다크 모드 (사용자 명시적 선택) =====
 * topbar 의 🌙 아이콘으로 토글. <html data-theme="dark"> 속성 기준.
 * 다크 톤: 먹색 계열 (Paper 테마와 같은 따뜻한 회색), brand pink 는 좀 더 밝게.
 */
html[data-theme="dark"] {
    --ink:                  #f2efe9;
    --ink-hover:            #ffffff;
    --ink-contrast:         #161513;
    --background:           #121110;
    --card:                 #1b1a18;
    --surface-2:            #201e1b;
    --foreground:           #f2efe9;
    --muted:                #24221f;
    --muted-foreground:     #a8a39a;
    --muted-foreground-2:   #7d7870;
    --muted-foreground-3:   #57534d;
    --border:               #2e2c28;
    --border-light:         #252320;
    --input:                #34312d;
    --ring:                 #f2efe9;
    --admin-sidebar:        #171614;
    --admin-sidebar-hover:  #24221f;
    --admin-sidebar-active: #24221f;
    --brand-ink:            #f56b80;
    --bs-link-color:        #f2efe9;
    --bs-link-color-rgb:    242, 239, 233;
    --bs-link-hover-color:  #f56b80;
    --bs-link-hover-color-rgb: 245, 107, 128;
    /* .text-primary / .bg-primary / .text-danger 등 Bootstrap 색 유틸 — 다크 바탕에서 보이도록 밝은 값 */
    --bs-primary-rgb:       242, 239, 233;
    --bs-danger-rgb:        242, 128, 124;
    --bs-success-rgb:       92, 199, 148;
    --bs-warning-rgb:       227, 169, 79;
    --bs-info-rgb:          138, 170, 240;
    --bs-secondary-rgb:     168, 163, 154;
    /* 다크모드 brand — 살짝 밝게 (대비 확보) */
    --brand-primary:        #f56b80;
    --brand-primary-hover:  #e94560;
    --brand-primary-light:  rgba(233, 69, 96, 0.16);
    /* status — 다크 배경 대응 */
    --success-light:        rgba(0, 199, 60, 0.12);
    --warning-light:        rgba(255, 159, 64, 0.12);
    --danger-light:         rgba(240, 68, 82, 0.15);
    --info-light:           rgba(96, 144, 232, 0.14);
    --success-foreground:   #5cc794;
    --warning-foreground:   #e3a94f;
    --danger-foreground:    #f2807c;
    --info-foreground:      #8aaaf0;
    /* shadow — 다크모드는 더 약하게 (어차피 안 보임) */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 1px 4px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-brand: 0 4px 16px rgba(233, 69, 96, 0.24);
}
html[data-theme="dark"] body { background: var(--background); color: var(--foreground); }
html[data-theme="dark"] .table-light,
html[data-theme="dark"] .table > thead.table-light th {
    background: var(--muted) !important;
    color: var(--muted-foreground) !important;
}
html[data-theme="dark"] .card { background: var(--card); border-color: var(--border); }
html[data-theme="dark"] .card-header { background: transparent; color: var(--foreground); border-bottom-color: var(--border-light); }
html[data-theme="dark"] .modal-content { background: var(--card); border-color: var(--border); }
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-body { background: var(--card); color: var(--foreground); }
html[data-theme="dark"] .modal-footer { background: var(--background); border-top-color: var(--border-light); }
html[data-theme="dark"] .modal-header .btn-close { filter: invert(1); }
html[data-theme="dark"] .btn-outline-dark,
html[data-theme="dark"] .btn-outline-secondary {
    color: var(--foreground);
    border-color: var(--border);
}
html[data-theme="dark"] .btn-outline-dark:hover,
html[data-theme="dark"] .btn-outline-secondary:hover {
    background: var(--muted);
    color: var(--foreground);
    border-color: var(--border);
}
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    background: var(--card);
    color: var(--foreground);
    border-color: var(--border);
}
html[data-theme="dark"] .form-control::placeholder { color: var(--muted-foreground-3); }
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    box-shadow: 0 0 0 3px rgba(96, 144, 232, 0.25);
}
html[data-theme="dark"] .table-hover tbody tr:hover { background: var(--muted); }
html[data-theme="dark"] code,
html[data-theme="dark"] .code-chip {
    background: var(--muted);
    color: var(--foreground);
    border-color: var(--border);
}
html[data-theme="dark"] .text-muted { color: var(--muted-foreground) !important; }

/* ===== Layout ===== */
.payvit-layout { display: flex; min-height: 100vh; }
.payvit-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.payvit-main { flex: 1; padding: var(--space-6); overflow-y: auto; }

/* /dashboard (사용자 콘솔) 전용 narrow 변형 — Toss admin 톤 (가독성 우선, 1280px 중앙 정렬).
 * admin 페이지(/admin/*)는 결제 내역 / 가맹점 목록 등 컬럼 많은 표가 많아 풀폭 유지가 나음. */
.payvit-main-narrow {
    width: 100%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Topbar 역할 배지 — 사용자 인지 한 눈에 =====
 * /dashboard topbar 우측에 사용자명 옆에 노출. 역할별 채도 절제 색조로 구분 (Toss 풍 subtle 배지).
 * 향후 DEVELOPER role 추가 시 .role-developer 클래스만 그대로 사용 가능. */
.topbar-role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    line-height: 1.5;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.topbar-role-badge.role-merchant  { background: var(--info-light);          color: var(--info-foreground); }
.topbar-role-badge.role-group     { background: var(--success-light);       color: var(--success-foreground); }
.topbar-role-badge.role-admin     { background: var(--brand-primary-light); color: var(--brand-primary-hover); }
.topbar-role-badge.role-developer { background: var(--muted);               color: var(--muted-foreground); }

/* ===== Topbar 사용자 정보 (아이콘 + 이름 + 그룹명) =====
 * 평문 이름 노출 대신 person 아이콘 + "님" 호칭으로 가독성 ↑.
 * GROUP 사용자만 우측에 그룹명 추가 (톤다운 색상). */
.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-sm);
    color: var(--foreground);
    white-space: nowrap;
}
.topbar-user > i { font-size: 1.1rem; color: var(--muted-foreground); }
.topbar-user-name { font-weight: var(--font-medium); }
.topbar-user-group {
    color: var(--muted-foreground);
    font-weight: var(--font-normal);
    margin-left: 2px;
}

/* ===== WebView 모드 — 앱 진입 시 자동 적용 =====
 * 향후 Payvit 앱이 webview 로 dashboard 를 띄울 때 ?from=app 또는 User-Agent 식별자 주입.
 * header.jsp 가 감지해서 <html> 에 mode-webview 클래스 부여. 이때 web 의 sidebar/topbar 는
 * 숨김 처리 (앱이 자체 네비 가짐). 같은 페이지 / 같은 URL / 같은 데이터, chrome 만 분기. */
html.mode-webview .payvit-sidebar,
html.mode-webview .payvit-topbar,
html.mode-webview .sidebar-overlay { display: none !important; }
html.mode-webview .payvit-main { padding: var(--space-4); }
html.mode-webview .dashboard-hero { padding-top: var(--space-3); }

/* ===== Sidebar — 밝은 종이색 (2026-10-19) =====
 * admin / dashboard sidebar.jsp 공용. 메뉴 링크는 .sidebar-nav a (sidebar.jsp 에서 <a> 직접 사용).
 * 활성 메뉴 = 흰 카드 한 장 + 왼쪽 핑크 점. 핑크는 여기서만 포인트로 쓴다. */
.payvit-sidebar {
    width: 248px; min-width: 248px;
    background: var(--admin-sidebar);
    color: var(--foreground);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
}
.sidebar-brand {
    padding: 0 var(--space-5);
    height: 64px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--foreground);
    flex: none;
}
.sidebar-brand__mark { width: 28px; height: 28px; display: block; flex: none; }
.sidebar-brand__word { font-size: 19px; font-weight: var(--font-extrabold); letter-spacing: -0.03em; color: var(--foreground); }
.sidebar-brand__word span { color: var(--brand-primary); }
.sidebar-brand__scope {
    font-size: 11px; font-weight: var(--font-bold); letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--muted-foreground-2);
    padding-left: 10px; border-left: 1px solid var(--border);
}
.sidebar-nav { flex: 1; padding: var(--space-2) 0 var(--space-4); }
.sidebar-nav a,
.sidebar-link {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    margin: 1px var(--space-3);
    color: var(--muted-foreground);
    text-decoration: none;
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.sidebar-nav a:hover,
.sidebar-link:hover {
    color: var(--foreground);
    background: var(--admin-sidebar-hover);
}
.sidebar-nav a.active,
.sidebar-link.active {
    color: var(--foreground);
    background: var(--admin-sidebar-active);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
    font-weight: var(--font-semibold);
}
.sidebar-nav a.active::before,
.sidebar-link.active::before {
    content: ""; position: absolute; left: -7px; top: 50%;
    width: 4px; height: 16px; margin-top: -8px;
    border-radius: 0 3px 3px 0; background: var(--brand-primary);
}
.sidebar-nav a i,
.sidebar-link i { font-size: 1.05rem; width: 20px; text-align: center; color: var(--muted-foreground-2); transition: color var(--transition-fast); }
.sidebar-nav a:hover i,
.sidebar-nav a.active i { color: var(--foreground); }
.sidebar-section-title {
    color: var(--muted-foreground-2);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    letter-spacing: 0.02em;
    padding: var(--space-5) var(--space-6) 6px;
}
.sidebar-section-title:first-child { padding-top: var(--space-2); }
/* 개발자 도구 섹션 — 일반 담당자에게 덜 튀도록 선으로 구분 (dashboard) */
.sidebar-section-title.dev-section {
    border-top: 1px solid var(--border);
    margin: var(--space-4) var(--space-5) 0;
    padding-left: var(--space-1); padding-right: var(--space-1);
}
.sidebar-footer {
    padding: var(--space-3) var(--space-5) var(--space-4);
    border-top: 1px solid var(--border);
    font-size: var(--text-xs);
    color: var(--muted-foreground-2);
    flex: none;
}
.sidebar-footer a {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--muted-foreground); text-decoration: none; font-weight: var(--font-medium);
    padding: 6px 8px; margin-left: -8px; border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}
.sidebar-footer a:hover { background: var(--admin-sidebar-hover); color: var(--foreground); }

/* ===== Topbar — 종이색 반투명 + 블러 (스크롤 시 본문 위에 떠 있음) ===== */
.payvit-topbar {
    position: sticky; top: 0; z-index: 1020;
    min-height: 64px;
    background: var(--background);  /* color-mix 미지원 브라우저용 */
    background: color-mix(in srgb, var(--background) 86%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    backdrop-filter: blur(14px) saturate(1.4);
    border-bottom: 1px solid var(--border);
    padding: var(--space-3) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}
.payvit-topbar .page-title {
    font-size: 18px; font-weight: var(--font-bold); letter-spacing: -0.02em;
    color: var(--foreground); margin: 0; line-height: 1.25;
}
.payvit-topbar .page-description { font-size: var(--text-sm); color: var(--muted-foreground); line-height: 1.35; }
.payvit-topbar .topbar-info { font-size: var(--text-sm); color: var(--muted-foreground); }
.payvit-topbar a.topbar-info {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 10px; border-radius: var(--radius-full);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}
.payvit-topbar a.topbar-info:hover { background: var(--muted); color: var(--foreground); }

/* ===== Card — Toss 풍 (큰 라운드 + subtle hover) ===== */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: none;                     /* Paper — 그림자 대신 선 */
    background: var(--card);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}
/* 인터랙션 가능한 카드만 hover 효과 (cursor:pointer 또는 .table-clickable 안의 행) */
.card[onclick]:hover,
.card.card-interactive:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.card[onclick]:active,
.card.card-interactive:active {
    transform: var(--tap-scale);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-light);
    font-weight: var(--font-bold);
    font-size: var(--text-md);
    letter-spacing: -0.02em;
    color: var(--foreground);
    padding: var(--space-4) var(--space-5);
}
.card-body {
    padding: var(--space-5);
}

/* ===== Table — Toss 풍 (여백 후함, hover 옅음) ===== */
.table {
    font-size: var(--text-base); margin-bottom: 0;
    --bs-table-bg: transparent;
    --bs-table-color: var(--foreground);
    --bs-table-hover-bg: var(--muted);
    --bs-table-hover-color: var(--foreground);
    --bs-table-striped-bg: var(--surface-2);
    font-variant-numeric: tabular-nums;   /* 금액·건수 열 정렬 */
}
.table th {
    font-weight: var(--font-semibold);
    color: var(--muted-foreground-2);
    font-size: var(--text-xs);
    letter-spacing: 0.01em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    padding: 12px 16px;
    background: transparent;
}
.table td {
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    padding: 13px 16px;
    font-size: var(--text-base);
    color: var(--foreground);
}
.table-sm th, .table-sm td { padding: 9px 12px; }
.table-hover tbody tr {
    transition: background var(--transition-fast);
}
.table-hover tbody tr:hover { background: var(--muted); }
/* Toss 풍 — 마지막 행 border 제거 */
.table tbody tr:last-child td { border-bottom: none; }
/* table-light (헤더 회색 배경) — Toss 는 헤더가 거의 transparent */
.table > thead.table-light th,
.table > :not(caption) > * > .table-light {
    background: var(--surface-2) !important;
    color: var(--muted-foreground-2) !important;
}

/* 비활성 가맹점/항목 행 — 시각적으로 흐리게 */
.table tbody tr.row-inactive { opacity: 0.5; }

/* 테이블 액션 버튼 묶음 셀 — 버튼이 줄바꿈되지 않도록 */
.table td.td-actions { white-space: nowrap; }

/* 사이드바 메뉴 옆 알림 배지 — Toss 풍 (붉은 점 + 카운트) */
.sidebar-badge {
    display: inline-block;
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: var(--font-bold);
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    text-align: center;
    letter-spacing: -0.02em;
}
/* 활성 메뉴(흰 카드) 안에서도 배지는 그대로 빨간 알약 */
.sidebar-nav a.active .sidebar-badge,
.sidebar-link.active .sidebar-badge {
    background: var(--danger);
    color: #fff;
}

/* 브랜드 컬러 미리보기 — 가맹점 상세 등에서 색상 코드 앞 작은 네모 */
.color-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    vertical-align: middle;
    margin-right: var(--space-1);
}

/* ===== Badge — Toss 풍 (살짝 더 큰 padding, 더 부드러운 색) ===== */
.badge {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    vertical-align: middle;
    letter-spacing: -0.01em;
}
.badge-active {
    display: inline-block; padding: 4px 10px; border-radius: var(--radius-full);
    font-size: var(--text-xs); font-weight: var(--font-semibold);
    background: var(--success-light); color: var(--success-foreground);
}
.badge-inactive {
    display: inline-block; padding: 4px 10px; border-radius: var(--radius-full);
    font-size: var(--text-xs); font-weight: var(--font-semibold);
    background: var(--muted); color: var(--muted-foreground);
}

/* 결제 상태 — pill 형 (info/success/danger 토큰 활용) */
.pay-status {
    display: inline-block; padding: 4px 10px; border-radius: var(--radius-full);
    font-size: var(--text-xs); font-weight: var(--font-semibold);
    letter-spacing: -0.01em;
}
.status-00 { background: var(--muted); color: var(--muted-foreground); }                       /* 대기 */
.status-10 { background: var(--info-light); color: var(--info-foreground); }                   /* 인증완료 — Toss Blue */
.status-20 { background: var(--success-light); color: var(--success-foreground); }             /* 승인 — Toss 그린 */
.status-30 { background: var(--muted); color: var(--muted-foreground); }                       /* 취소 — 회색 (Toss 풍 차분) */
.status-88 { background: #F4F1FB; color: #7B5BD6; }                                            /* 만료 — 보라 */
.status-97 { background: var(--warning-light); color: var(--warning-foreground); }             /* 불확실 — 주황 */
.status-99 { background: var(--danger-light); color: var(--danger-foreground); }               /* 실패 — Toss 빨강 */
.status-89 { background: var(--muted); color: var(--muted-foreground); }                       /* 파기 — 회색 */

/* ===== Button — Toss 풍 (둥근 corner + tap feedback) ===== */
.btn {
    font-weight: var(--font-semibold);
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast), border-color var(--transition-fast),
                color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
    padding: 9px 16px;
    font-size: var(--text-base);
    letter-spacing: -0.01em;
    --bs-btn-focus-box-shadow: 0 0 0 3px rgba(22, 21, 19, 0.12);
}
.btn:active { transform: var(--tap-scale); }
.btn-sm {
    font-size: var(--text-sm);
    padding: 6px 12px;
    border-radius: 8px;
}

/* 테이블 내 버튼 — 더 작고 컴팩트 */
.table .btn-sm { padding: 4px 10px; font-size: var(--text-xs); border-radius: var(--radius-sm); }

/* 주 버튼 = 먹색 (Paper). 핑크는 버튼 면에 쓰지 않는다 */
.btn-primary, .btn-dark {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--ink-contrast);
    /* JS 가 disabled 처리할 때 Bootstrap 기본 파랑으로 바뀌지 않게 */
    --bs-btn-disabled-bg: var(--ink);
    --bs-btn-disabled-border-color: var(--ink);
    --bs-btn-disabled-color: var(--ink-contrast);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.btn-dark:hover, .btn-dark:focus, .btn-dark:active {
    background: var(--ink-hover) !important;
    border-color: var(--ink-hover) !important;
    color: var(--ink-contrast) !important;
}
/* 보조 강조 — 핑크 글자 + 옅은 테두리 */
.btn-outline-primary {
    color: var(--brand-ink);
    border-color: rgba(233, 69, 96, 0.35);
    background: var(--card);
}
.btn-outline-primary:hover, .btn-outline-primary:active {
    background: var(--brand-primary-light) !important;
    color: var(--brand-ink) !important;
    border-color: rgba(233, 69, 96, 0.55) !important;
}
.btn-outline-secondary,
.btn-outline-dark,
.btn-light {
    color: var(--foreground);
    border-color: var(--border);
    background: var(--card);
}
.btn-outline-secondary:hover, .btn-outline-secondary:active,
.btn-outline-dark:hover, .btn-outline-dark:active,
.btn-light:hover, .btn-light:active {
    background: var(--muted) !important;
    color: var(--foreground) !important;
    border-color: #d3cec4 !important;
}
.btn-secondary {
    color: var(--foreground);
    background: var(--muted);
    border-color: var(--muted);
}
.btn-secondary:hover, .btn-secondary:active {
    color: var(--foreground) !important;
    background: var(--admin-sidebar-hover) !important;
    border-color: var(--admin-sidebar-hover) !important;
}
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover, .btn-success:active { background: var(--success-foreground) !important; border-color: var(--success-foreground) !important; color: #fff !important; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover, .btn-danger:active { background: var(--danger-foreground) !important; border-color: var(--danger-foreground) !important; color: #fff !important; }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-warning:hover, .btn-warning:active { background: var(--warning-foreground) !important; border-color: var(--warning-foreground) !important; color: #fff !important; }
.btn-outline-success { color: var(--success-foreground); border-color: rgba(31, 138, 91, 0.35); background: var(--card); }
.btn-outline-success:hover { background: var(--success-light) !important; color: var(--success-foreground) !important; border-color: rgba(31, 138, 91, 0.55) !important; }
.btn-outline-danger { color: var(--danger-foreground); border-color: rgba(214, 69, 69, 0.35); background: var(--card); }
.btn-outline-danger:hover { background: var(--danger-light) !important; color: var(--danger-foreground) !important; border-color: rgba(214, 69, 69, 0.55) !important; }
.btn-outline-warning { color: var(--warning-foreground); border-color: rgba(194, 122, 18, 0.35); background: var(--card); }
.btn-outline-warning:hover { background: var(--warning-light) !important; color: var(--warning-foreground) !important; border-color: rgba(194, 122, 18, 0.55) !important; }
.btn-outline-info { color: var(--info-foreground); border-color: rgba(58, 102, 196, 0.35); background: var(--card); }
.btn-outline-info:hover { background: var(--info-light) !important; color: var(--info-foreground) !important; }
.btn-link { color: var(--muted-foreground); text-decoration: none; }
.btn-link:hover { color: var(--foreground); }
.btn:disabled, .btn.disabled { opacity: 0.45; }

/* ===== 체크박스 + 텍스트 정렬 ===== */
.check-label,
.channel-check,
label:has(input[type="checkbox"]) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}
input[type="checkbox"] {
    margin: 0;
    vertical-align: middle;
}

/* ===== 채널 체크박스 (결제수단 선택) — Toss 풍 chip 스타일 ===== */
.channel-check {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-full);
    font-size: var(--text-sm); font-weight: var(--font-medium);
    background: var(--card);
    cursor: pointer; transition: all var(--transition-fast); user-select: none;
}
.channel-check:hover {
    border-color: var(--muted-foreground-3);
    background: var(--muted);
}
.channel-check:has(input:checked) {
    border-color: var(--brand-primary); background: var(--brand-primary-light);
    color: var(--brand-primary); font-weight: var(--font-semibold);
}
.channel-check:active { transform: var(--tap-scale); }
.channel-check input { accent-color: var(--brand-primary); cursor: pointer; margin: 0; }

/* ===== 행 클릭 가능 테이블 ===== */
.table-clickable tbody tr { cursor: pointer; }
.table-clickable tbody tr:hover { background: var(--muted); }
.table-clickable tbody tr td:last-child { cursor: default; }

/* ===== Form — Toss 풍 (큰 padding + 부드러운 focus ring) ===== */
.form-control, .form-select {
    border: 1px solid var(--input);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    padding: 9px 13px;
    background-color: var(--card);
    color: var(--foreground);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-select { padding-right: 36px; }
.form-control:hover, .form-select:hover {
    border-color: var(--muted-foreground-3);
}
.form-control:focus, .form-select:focus {
    border-color: var(--ring);
    background-color: var(--card);        /* Bootstrap 기본(body 배경=종이색)으로 바뀌지 않게 */
    color: var(--foreground);
    box-shadow: 0 0 0 3px rgba(22, 21, 19, 0.08);
    outline: none;
}
.form-control:disabled, .form-control[readonly], .form-select:disabled {
    background-color: var(--muted);
    color: var(--muted-foreground);
}
.form-control::placeholder {
    color: var(--muted-foreground-2);
}
.form-control-sm, .form-select-sm {
    padding: 7px 12px;
    font-size: var(--text-sm);
    border-radius: var(--radius-sm);
}
.form-select-sm { padding-right: 32px; }   /* 화살표 자리 — 위 padding 이 덮어써 긴 가맹점명이 화살표와 겹치던 문제 */
.form-label {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--foreground);
    margin-bottom: 6px;
}

/* ===== Modal — Toss 풍 (더 둥근 corner + subtle shadow) ===== */
.modal-content {
    border-radius: var(--radius-xl);              /* Toss 는 모달도 매우 둥글게 */
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}
.modal.fade .modal-dialog { transform: translateY(12px) scale(0.98); transition: transform 0.35s var(--ease-out); }
.modal.show .modal-dialog { transform: none; }
.modal-header {
    background: var(--card);
    border-bottom: 1px solid var(--border-light);
    padding: 22px 26px 18px;
}
.modal-header .modal-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--foreground);
    letter-spacing: -0.01em;
}
.modal-header .btn-close {
    opacity: 0.45;
    transition: opacity var(--transition-fast);
}
.modal-header .btn-close:hover { opacity: 1; }
.modal-footer {
    background: var(--background);              /* 종이색 footer — 본문과 살짝 구분 */
    border-top: 1px solid var(--border-light);
    padding: 14px 26px;
    gap: var(--space-2);
}
.modal-body {
    padding: 22px 26px;
    font-size: var(--text-base);
    color: var(--foreground);
}
/* 모달 backdrop — 먹색 반투명 */
.modal-backdrop { --bs-backdrop-bg: #161513; }
.modal-backdrop.show {
    opacity: 0.32;
}

/* 모달 내 테이블 */
.modal-body .table { margin-bottom: 0; }
.modal-body .table td {
    font-size: var(--text-base);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
}
.modal-body .table td:first-child {
    color: var(--muted-foreground);
    font-size: var(--text-sm);
    width: 35%;
}

/* 모달 섹션 타이틀 */
.section-title {
    font-size: var(--text-md);
    font-weight: var(--font-bold);
    color: var(--foreground);
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.section-title i { color: var(--brand-primary); font-size: var(--text-base); }

/* 모달 내 폼 레이블/입력 */
.modal-body .form-label {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--foreground);
    margin-bottom: 6px;
}
.modal-body .form-control,
.modal-body .form-select {
    font-size: var(--text-base);
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.modal-body .form-control:focus,
.modal-body .form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.08);
}
.modal-body small.text-muted {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
}

/* 모달 내 알림 */
.modal-body .alert {
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
    border: none;
}

/* 모달 버튼 통일 */
.modal-footer .btn {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    padding: 8px 20px;
    border-radius: var(--radius-md);
}

/* 컬러 헤더 모달 (NiceVAN, 테스트결제 등) — Paper 테마에서는 모든 모달 헤더를 흰 바탕으로 통일.
 * JSP 의 인라인 style="background:..." 를 건드리지 않고 여기서 덮는다. */
.modal-header[style*="background"] {
    background: var(--card) !important;
    color: var(--foreground) !important;
    border-bottom: 1px solid var(--border-light);
}
.modal-header[style*="background"] .modal-title {
    color: var(--foreground) !important;
}
.modal-header .btn-close-white { filter: none; }
html[data-theme="dark"] .modal-header .btn-close-white { filter: invert(1); }

/* ===== Tab — Toss 풍 (더 두꺼운 active border + smooth) ===== */
.nav-tabs {
    border-bottom: 1px solid var(--border);
    gap: var(--space-2);
}
.nav-tabs .nav-link {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--muted-foreground);
    border: none;
    border-bottom: 2.5px solid transparent;
    padding: var(--space-3) var(--space-4);
    margin-bottom: -1px;
    transition: all var(--transition-fast);
    border-radius: 0;
}
.nav-tabs .nav-link:hover {
    color: var(--foreground);
    border-bottom-color: var(--border);
    background: transparent;
}
.nav-tabs .nav-link.active {
    color: var(--foreground);
    border-bottom-color: var(--brand-primary);
    background: transparent;
}

/* ===== JSON Output ===== */
.json-output {
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
}

/* ===== 대시보드 지표 카드 — Toss 풍 큰 숫자 강조 ===== */
.stat-label {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    font-weight: var(--font-medium);
}
.stat-sub {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    font-weight: var(--font-medium);
}
/* Toss 풍 — 통계 숫자는 큼직하게 + 굵게 */
.stat-num {
    font-size: var(--text-3xl);
    font-weight: var(--font-extrabold);
    color: var(--foreground);
    line-height: 1.2;
    letter-spacing: -0.02em;   /* Toss 풍 — 큰 숫자는 자간 살짝 좁게 */
}

/* ===== 브랜드 버튼 (등록/저장 등 primary 액션) — Toss 풍 ===== */
.btn-brand {
    background: var(--ink);
    color: var(--ink-contrast);
    border: 1px solid var(--ink);
    border-radius: var(--radius-md);
    font-weight: var(--font-semibold);
    transition: all var(--transition-fast);
}
.btn-brand:hover, .btn-brand:focus {
    background: var(--ink-hover);
    border-color: var(--ink-hover);
    color: var(--ink-contrast);
    box-shadow: var(--shadow-brand);
}
.btn-brand:active {
    transform: var(--tap-scale);
}
.btn-brand:disabled, .btn-brand.disabled {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--ink-contrast);
    opacity: 0.3;
}

/* ===== 서버 정보 (topbar) ===== */
.server-info {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
}
.server-info code {
    background: var(--muted);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

/* ===========================================================================
 * 공통 유틸 클래스 (Utility)
 *
 * 여러 JSP 에 반복되던 인라인 스타일 패턴을 단일 클래스로 통합.
 * 새 JSP 작성 시 인라인 style 대신 아래 클래스를 우선 사용.
 * =========================================================================== */

/* --- 텍스트 유틸 클래스 (.txt-*) 는 payvit-tokens.css 에서 정의 --- */

/* --- 인라인 코드 chip (여러 모달에 반복 패턴) --- */
.code-chip {
    font-family: var(--font-mono); font-size: var(--text-xs);
    padding: 2px 6px; background: var(--muted);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--foreground);
}

/* --- 아이콘 버튼 (.btn-icon / .btn-icon-sm) — 인쇄/복사 등 아이콘만 있는 컴팩트 버튼 --- */
.btn-icon {
    font-size: var(--text-xs); padding: 2px 8px;
    line-height: 1.4;
}
.btn-icon-xs {
    font-size: 10px; padding: 2px 6px;
    line-height: 1.3;
}

/* --- 상태 아이콘 (결제/프로세스 상태 페이지 공통) --- */
.status-icon {
    width: 64px; height: 64px; border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; margin: 0 auto var(--space-4);
}
.status-icon.success { background: var(--success-light); color: var(--success-foreground); }
.status-icon.danger  { background: var(--danger-light);  color: var(--danger-foreground); }
.status-icon.warning { background: var(--warning-light); color: var(--warning-foreground); }
.status-icon.info    { background: var(--info-light);    color: var(--info-foreground); }

/* --- 섹션 구분선 --- */
.divider-dashed {
    border-top: 1px dashed var(--border);
    margin: var(--space-3) 0;
}

/* --- 간격/여백 축약 --- */
.gap-tight { gap: var(--space-1); }
.gap-snug  { gap: var(--space-2); }
.gap-md    { gap: var(--space-3); }

/* --- flex 축약 --- */
.flex-row-center { display: flex; align-items: center; gap: var(--space-2); }
.flex-row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }

/* --- 공통 키-값 테이블 (모달 상세 패널) --- */
.kv-table { margin: 0; width: 100%; }
.kv-table td { padding: 6px 0; border: none; vertical-align: top; font-size: var(--text-sm); }
.kv-table td.kv-k {
    color: var(--muted-foreground); width: 38%;
    font-size: var(--text-xs); font-weight: var(--font-semibold);
    padding-right: var(--space-2);
}
.kv-table td.kv-v { color: var(--foreground); word-break: break-all; }
.kv-table tr + tr td { border-top: 1px dashed var(--border-light); }

/* ===== Alert dismiss 버튼 (배너 닫기) ===== */
.alert-dismiss-btn {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 1.1em;
    padding: 0;
}

/* ===== 환경 표시 알림 박스 (apitest 운영/개발) ===== */
.alert-env-prod {
    background: var(--danger-light);
    border: 1px solid var(--danger);
    color: var(--danger-foreground);
}
.alert-env-dev {
    background: var(--warning-light);
    border: 1px solid var(--warning);
    color: var(--warning-foreground);
}

/* ===== 일반 텍스트 link (밑줄만, 색상 = foreground) ===== */
.link-plain {
    text-decoration: underline;
    color: var(--foreground);
}
.link-plain:hover { color: var(--brand-primary); }

/* ===== 검색창 안 좌측 아이콘 오버레이 (input 안 search 아이콘) ===== */
.search-icon-overlay {
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-foreground);
    pointer-events: none;
}

/* ===== 북마크 링크 (topbar 패널 안) ===== */
.bookmark-link {
    flex: 1;
    color: var(--foreground);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bookmark-link:hover { color: var(--brand-primary); }

/* ===== 모바일 메뉴 토글 버튼 ===== */
.sidebar-toggle {
    display: none;
    background: none; border: none;
    font-size: 1.3rem; color: var(--foreground);
    padding: var(--space-2); cursor: pointer;
}

/* ===== 모바일 반응형 ===== */
@media (max-width: 992px) {
    /* 사이드바 숨김 + 오버레이 전환 */
    .payvit-sidebar {
        position: fixed; left: -270px; top: 0; bottom: 0; z-index: 1050;
        width: 248px; height: auto; transition: left 0.3s var(--ease-out);
    }
    /* 그림자는 열렸을 때만 — 닫힌 상태에서 그림자가 화면 왼쪽에 회색 띠로 비치지 않게 */
    .payvit-sidebar.open { left: 0; box-shadow: var(--shadow-xl); }

    /* 사이드바 열림 시 오버레이 */
    .sidebar-overlay {
        display: none; position: fixed; inset: 0; z-index: 1040;
        background: rgba(22,21,19,0.32);
        -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    }
    .sidebar-overlay.show { display: block; }

    /* 토글 버튼 표시 */
    .sidebar-toggle { display: block; }

    /* 메인 영역 여백 조정 */
    .payvit-main { padding: var(--space-3); }

    /* 테이블 가로 스크롤 */
    .card-body:has(.table) { overflow-x: auto; }
    .table { min-width: 700px; }

    /* 모달 풀스크린에 가깝게 */
    .modal-dialog.modal-lg { max-width: 95%; margin: var(--space-3) auto; }
}

@media (max-width: 576px) {
    /* 통계 카드 1열 */
    .row .col-md-3, .row .col-md-2 { width: 50%; }

    /* topbar 간소화 */
    .payvit-topbar { padding: var(--space-2) var(--space-3); }
    .server-info { display: none; }

    /* 검색 폼 1열 */
    .row.g-2 > [class*="col-md-"] { width: 100%; }
}

/* ===========================================================================
 * Toss 풍 컴포넌트 4종 (2026-04-28)
 *
 * 직관적이고 쉬운 UI 패턴 — Toss 가이드 페이지 분석 후 도입.
 *
 *  1) .stat-card        — 통계 카드 (라벨 → 큰 숫자 → 보조)
 *  2) .step-flow        — 단계 다이어그램 (1→2→3→...)
 *  3) .alert-toss       — 토스 풍 알림 박스 (info/success/warning/danger)
 *  4) .checklist-toss   — 체크리스트
 * =========================================================================== */

/* ─── 1. Stat Card (통계 카드) ───────────────────────────────────────────── */
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-5);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 110px;
}
.stat-card[onclick],
.stat-card.stat-card-link {
    cursor: pointer;
}
.stat-card[onclick]:hover,
.stat-card.stat-card-link:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    border-color: var(--brand-primary-light);
}
.stat-card[onclick]:active,
.stat-card.stat-card-link:active {
    transform: var(--tap-scale);
}

/* 위험 강조 variant — 24h 실패 결제 1건 이상 등 */
.stat-card.stat-card-danger {
    background: var(--danger-light);
    border-color: var(--danger);
}
.stat-card.stat-card-danger .stat-card-value {
    color: var(--danger-foreground);
}
.stat-card.stat-card-danger .stat-card-sub {
    color: var(--danger-foreground);
    font-weight: var(--font-semibold);
}

/* 작은 회색 라벨 (위) */
.stat-card-label {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    font-weight: var(--font-medium);
    display: flex;
    align-items: center;
    gap: 6px;
}
.stat-card-label i { font-size: 1rem; opacity: 0.7; }

/* 큰 검정 숫자 (중간) */
.stat-card-value {
    font-size: var(--text-3xl);
    font-weight: var(--font-extrabold);
    color: var(--foreground);
    letter-spacing: -0.02em;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;   /* 숫자 폭 균일 — 변동 시 흔들림 X */
}
.stat-card-value.value-success { color: var(--success-foreground); }
.stat-card-value.value-danger  { color: var(--danger-foreground); }
.stat-card-value.value-warning { color: var(--warning-foreground); }
.stat-card-value.value-brand   { color: var(--brand-primary); }

/* 보조 회색 텍스트 (아래) */
.stat-card-sub {
    font-size: var(--text-xs);
    color: var(--muted-foreground-2);
    font-weight: var(--font-medium);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;       /* 아래로 밀어내기 (카드 높이 일정) */
}

/* 변화 화살표 (어제 대비 ↑ 12% 등) */
.stat-card-trend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}
.stat-card-trend.trend-up   { color: var(--success-foreground); background: var(--success-light); }
.stat-card-trend.trend-down { color: var(--danger-foreground);  background: var(--danger-light); }
.stat-card-trend.trend-flat { color: var(--muted-foreground);   background: var(--muted); }

/* ─── 2. Step Flow (단계 다이어그램) ─────────────────────────────────────── */
/*
 * 사용 예:
 *   <ol class="step-flow">
 *     <li class="step done">    <span class="step-num">1</span><div class="step-title">가맹점 등록</div><div class="step-desc">완료</div></li>
 *     <li class="step active">  <span class="step-num">2</span><div class="step-title">CAT-ID 할당</div></li>
 *     <li class="step">         <span class="step-num">3</span><div class="step-title">계약서 등록</div></li>
 *   </ol>
 *
 * 또는 가로 흐름:
 *   <ol class="step-flow step-flow-horizontal"> ... </ol>
 */
.step-flow {
    list-style: none;
    padding: 0;
    margin: 0;
}
.step-flow .step {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    position: relative;
    list-style: none;
}
/* 세로 연결선 */
.step-flow .step::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 36px;
    bottom: -4px;
    width: 2px;
    background: var(--border);
    z-index: 0;
}
.step-flow .step:last-child::before { display: none; }
.step-flow .step.done::before { background: var(--success); }

.step-flow .step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: var(--text-sm);
    color: var(--muted-foreground-2);
    background: var(--muted);
    border: 2px solid var(--border);
    z-index: 1;
    position: relative;
    transition: all var(--transition-fast);
}
.step-flow .step.done .step-num {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}
.step-flow .step.done .step-num::before {
    content: '✓';
    font-size: 16px;
}
.step-flow .step.done .step-num-text { display: none; }
.step-flow .step.active .step-num {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px var(--brand-primary-light);
}
.step-flow .step.failed .step-num {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.step-flow .step.failed .step-num::before {
    content: '✕';
    font-size: 14px;
    font-weight: var(--font-bold);
}
.step-flow .step.failed .step-num-text { display: none; }

/* skipped — 의도적으로 미실행 (사업자등록증 미첨부 등) */
.step-flow .step.skipped .step-num {
    background: var(--card);
    color: var(--muted-foreground-2);
    border: 2px dashed var(--border);
}
.step-flow .step.skipped .step-title {
    color: var(--muted-foreground);
}
.step-flow .step.skipped::before {
    background: var(--border);
    border-style: dashed;
    border-left: 1px dashed var(--border);
    background: transparent;
}

.step-flow .step-body {
    flex: 1;
    padding-top: 4px;
    min-width: 0;
}
.step-flow .step-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--foreground);
    line-height: 1.3;
}
.step-flow .step.done .step-title,
.step-flow .step.failed .step-title {
    /* 완료/실패 단계 — 텍스트 그대로 (회색 처리 X, 명확한 상태 우선) */
}
.step-flow .step-desc {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    margin-top: 2px;
    line-height: 1.5;
    word-break: break-word;
}

/* 가로 흐름 variant (작은 단계) */
.step-flow-horizontal {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
}
.step-flow-horizontal .step {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0;
    flex: 1;
    min-width: 80px;
}
.step-flow-horizontal .step::before {
    top: 16px;
    left: calc(50% + 18px);
    right: calc(-50% + 18px);
    bottom: auto;
    width: auto;
    height: 2px;
}
.step-flow-horizontal .step-body {
    padding-top: var(--space-2);
}
.step-flow-horizontal .step-title { font-size: var(--text-sm); }
.step-flow-horizontal .step-desc { display: none; }

/* ─── 3. Alert (토스 풍 알림 박스) ──────────────────────────────────────── */
/*
 * 사용 예:
 *   <div class="alert-toss alert-toss-info">
 *     <i class="bi bi-info-circle alert-toss-icon"></i>
 *     <div class="alert-toss-body">
 *       <div class="alert-toss-title">알아두세요</div>
 *       <div class="alert-toss-text">결제 링크는 ...</div>
 *     </div>
 *   </div>
 */
.alert-toss {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--info);
    background: var(--info-light);
    margin: var(--space-3) 0;
    align-items: flex-start;
}
.alert-toss-icon {
    font-size: 1.1rem;
    color: var(--info-foreground);
    margin-top: 1px;
    flex-shrink: 0;
}
.alert-toss-body { flex: 1; min-width: 0; }
.alert-toss-title {
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    color: var(--info-foreground);
    margin-bottom: 4px;
    line-height: 1.4;
}
.alert-toss-text {
    font-size: var(--text-sm);
    color: var(--foreground);
    line-height: 1.6;
}
.alert-toss-text code {
    background: rgba(255,255,255,0.7);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
}

/* variant: info / success / warning / danger */
.alert-toss-info {
    border-left-color: var(--info);
    background: var(--info-light);
}
.alert-toss-info .alert-toss-icon,
.alert-toss-info .alert-toss-title { color: var(--info-foreground); }

.alert-toss-success {
    border-left-color: var(--success);
    background: var(--success-light);
}
.alert-toss-success .alert-toss-icon,
.alert-toss-success .alert-toss-title { color: var(--success-foreground); }

.alert-toss-warning {
    border-left-color: var(--warning);
    background: var(--warning-light);
}
.alert-toss-warning .alert-toss-icon,
.alert-toss-warning .alert-toss-title { color: var(--warning-foreground); }

.alert-toss-danger {
    border-left-color: var(--danger);
    background: var(--danger-light);
}
.alert-toss-danger .alert-toss-icon,
.alert-toss-danger .alert-toss-title { color: var(--danger-foreground); }

/* 컴팩트 variant — 제목 없이 본문만 (한 줄짜리 안내) */
.alert-toss-compact {
    padding: 10px 14px;
    align-items: center;
}
.alert-toss-compact .alert-toss-title { display: none; }
.alert-toss-compact .alert-toss-text { font-size: var(--text-sm); }

/* ─── 4. Checklist (체크리스트) ──────────────────────────────────────────── */
/*
 * 사용 예:
 *   <ul class="checklist-toss">
 *     <li class="check-item done">API Key 발급</li>
 *     <li class="check-item done">결제 생성 테스트</li>
 *     <li class="check-item">웹훅 endpoint 구현</li>
 *   </ul>
 */
.checklist-toss {
    list-style: none;
    padding: 0;
    margin: var(--space-3) 0;
}
.checklist-toss .check-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-light);
    font-size: var(--text-base);
    color: var(--foreground);
    line-height: 1.5;
}
.checklist-toss .check-item:last-child { border-bottom: none; }
.checklist-toss .check-item::before {
    content: '';
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    margin-top: 1px;
    transition: all var(--transition-fast);
}
.checklist-toss .check-item.done {
    color: var(--muted-foreground);
}
.checklist-toss .check-item.done::before {
    background: var(--success);
    border-color: var(--success);
    /* CSS 만으로 체크 표시 — SVG 대신 mask */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.5L7 12L13 5' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: 16px 16px;
    background-repeat: no-repeat;
    background-position: center;
}
.checklist-toss .check-item.done .check-text {
    text-decoration: line-through;
    text-decoration-color: var(--muted-foreground-3);
}
.checklist-toss .check-item.required::after {
    content: '필수';
    margin-left: auto;
    flex-shrink: 0;
    background: var(--danger-light);
    color: var(--danger-foreground);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    align-self: center;
}

/* 다크모드 — 컴포넌트 4종 미세 조정 */
html[data-theme="dark"] .stat-card { background: var(--card); border-color: var(--border); }
html[data-theme="dark"] .stat-card[onclick]:hover { border-color: var(--brand-primary); }
html[data-theme="dark"] .alert-toss-text code { background: rgba(0,0,0,0.3); color: var(--foreground); }
html[data-theme="dark"] .checklist-toss .check-item::before { background: var(--muted); }

/* ═══════════════════════════════════════════════════════════════════
   결제 캘린더 (/admin/calendar) — dashboard/calendar 스타일 이식
   ═══════════════════════════════════════════════════════════════════ */

/* ===== 컴팩트 툴바 ===== */
.cal-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.cal-month-pager {
    display: inline-flex; align-items: center; gap: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.cal-pager-btn {
    background: transparent; border: none;
    padding: 8px 14px;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1rem;
}
.cal-pager-btn:hover { background: var(--muted); color: var(--foreground); }
.cal-month-label {
    padding: 8px 16px;
    font-size: var(--text-md);
    font-weight: var(--font-bold);
    color: var(--foreground);
    letter-spacing: -0.01em;
    min-width: 100px; text-align: center;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}
.cal-today-btn {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    font-size: var(--text-sm); font-weight: var(--font-medium);
    color: var(--foreground);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex; align-items: center; gap: 6px;
}
.cal-today-btn:hover { background: var(--brand-primary-light); border-color: var(--brand-primary); color: var(--brand-primary); }
.cal-today-btn i { color: var(--brand-primary); font-size: 0.95rem; }

/* ===== KPI 스트립 — 4 카드 inline ===== */
.cal-kpi-strip {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.cal-kpi {
    padding: var(--space-4);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex; flex-direction: column; gap: 4px;
}
.cal-kpi-label {
    font-size: var(--text-sm); color: var(--muted-foreground); font-weight: var(--font-medium);
    display: flex; align-items: center; gap: 6px;
}
/* 라벨 옆 micro-tag — "승인" 같은 컨텍스트 inline 노출 */
.cal-kpi-tag {
    display: inline-block;
    padding: 1px 6px;
    background: var(--success-light);
    color: var(--success-foreground);
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: var(--font-semibold);
    letter-spacing: 0.02em;
}
.cal-kpi-value { font-size: var(--text-xl); font-weight: var(--font-bold); color: var(--foreground); line-height: 1.2; word-break: break-all; }
.cal-kpi-value.value-brand { color: var(--brand-primary); }
.cal-kpi-sub   { font-size: var(--text-xs); color: var(--muted-foreground); margin-top: 2px; }
@media (max-width: 768px) {
    .cal-kpi-strip { grid-template-columns: repeat(2, 1fr); }
    .cal-kpi-value { font-size: var(--text-lg); }
}

/* ===== 캘린더 카드 ===== */
.cal-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.cal-weekday-row {
    display: grid; grid-template-columns: repeat(7, 1fr);
    background: var(--background);
    border-bottom: 1px solid var(--border);
}
.cal-weekday {
    padding: var(--space-3) var(--space-2);
    text-align: center;
    font-size: var(--text-sm); font-weight: var(--font-semibold);
    color: var(--muted-foreground);
    letter-spacing: 0.02em;
}
.cal-weekday.wd-sun { color: var(--danger-foreground); }
.cal-weekday.wd-sat { color: var(--info-foreground); }

/* ===== 캘린더 셀 ===== */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell {
    position: relative;
    min-height: 110px;
    padding: var(--space-3);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    display: flex; flex-direction: column;
    background: var(--card);
    transition: all var(--transition-fast);
}
.cal-cell:nth-child(7n)            { border-right: none; }
.cal-cell:nth-last-child(-n+7)     { border-bottom: none; }

.cal-cell.cell-empty               { background: var(--background); }   /* 다른 달 */
.cal-cell.cell-clickable           { cursor: pointer; }
.cal-cell.cell-clickable:hover {
    background: var(--brand-primary-light);
    box-shadow: inset 0 0 0 1px rgba(233, 69, 96, 0.2);
    z-index: 1;
}

.cal-cell-day {
    font-size: var(--text-sm); font-weight: var(--font-semibold);
    color: var(--foreground);
    line-height: 1.2;
}
.cal-cell-day.day-sun { color: var(--danger-foreground); }
.cal-cell-day.day-sat { color: var(--info-foreground); }
.cal-cell.cell-empty .cal-cell-day { color: var(--muted-foreground-3); font-weight: var(--font-normal); }

/* 오늘 dot marker — 셀 우상단 */
.cal-cell-today-dot {
    position: absolute;
    top: 8px; right: 10px;
    width: 7px; height: 7px;
    background: var(--brand-primary);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.18);
}

.cal-cell-amount {
    font-size: var(--text-sm); font-weight: var(--font-bold);
    color: var(--foreground);
    line-height: 1.15;
    margin-top: auto;
    word-break: break-all;
}
.cal-cell-count {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    margin-top: 2px;
}
/* 최고 매출일 — 살짝 강조 boundary */
.cal-cell.cell-best { box-shadow: inset 0 0 0 2px var(--brand-primary); }
.cal-cell.cell-best .cal-cell-amount { color: var(--brand-primary); }

/* heatmap 강도 — 매출 비율 (0~1) 따라 brand-primary tint 농도 ↑ */
.cal-cell[data-intensity="1"]  { background: rgba(233, 69, 96, 0.04); }
.cal-cell[data-intensity="2"]  { background: rgba(233, 69, 96, 0.08); }
.cal-cell[data-intensity="3"]  { background: rgba(233, 69, 96, 0.13); }
.cal-cell[data-intensity="4"]  { background: rgba(233, 69, 96, 0.20); }

/* 모바일 — 셀 더 작게 */
@media (max-width: 768px) {
    .cal-cell { min-height: 70px; padding: var(--space-2); }
    .cal-cell-amount { font-size: var(--text-xs); }
    .cal-cell-count { display: none; }    /* 모바일 가독성 위해 건수 숨김 */
}

/* ===== 캘린더 모달 — 요일 + 큰 합계 + 진행 bar breakdown ===== */
.cal-modal-content { border: none; border-radius: var(--radius-lg); }
.cal-modal-header  { border-bottom: 1px solid var(--border-light); padding: var(--space-4) var(--space-5); }
.cal-modal-date    { font-size: var(--text-lg); font-weight: var(--font-bold); color: var(--foreground); letter-spacing: -0.01em; }
.cal-modal-rel     { margin-top: 2px; }

.cal-modal-summary {
    display: flex; align-items: center; justify-content: space-around;
    padding: var(--space-4) 0;
    background: var(--background);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
}
.cal-modal-divider { width: 1px; height: 40px; background: var(--border); }
.cal-modal-stat-label { font-size: var(--text-sm); color: var(--muted-foreground); text-align: center; margin-bottom: 4px; }
.cal-modal-stat-value { font-size: var(--text-2xl); font-weight: var(--font-bold); text-align: center; line-height: 1; word-break: break-all; }
.cal-modal-stat-value.value-brand { color: var(--brand-primary); }

/* 결제수단 진행 bar (캘린더 모달용) */
.pm-row {
    display: grid; grid-template-columns: 100px 1fr auto auto;
    align-items: center; gap: var(--space-3);
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: var(--text-sm);
}
.pm-row:last-child { border-bottom: none; }
.pm-name { font-weight: var(--font-medium); color: var(--foreground); }
.pm-bar-track { height: 6px; background: var(--muted); border-radius: var(--radius-full); overflow: hidden; }
.pm-bar-fill { height: 100%; background: var(--brand-primary); border-radius: var(--radius-full); transition: width var(--transition-base); }
.pm-amount { font-weight: var(--font-semibold); color: var(--foreground); white-space: nowrap; }
.pm-pct    { font-size: var(--text-xs); color: var(--muted-foreground); white-space: nowrap; min-width: 36px; text-align: right; }

/* ===========================================================================
 * Paper 정돈 레이어 (2026-10-19)
 *
 * JSP 에 흩어져 있는 Bootstrap 기본 클래스(bg-* 배지, alert, pagination, dropdown 등)를
 * 마크업 수정 없이 Paper 톤으로 맞춘다. 파일 맨 끝에 두어 위 규칙보다 우선.
 * =========================================================================== */

/* --- 배지: Bootstrap 원색 → 옅은 바탕 + 진한 글자 알약 --- */
.badge.bg-success   { background-color: var(--success-light) !important; color: var(--success-foreground) !important; }
.badge.bg-danger    { background-color: var(--danger-light)  !important; color: var(--danger-foreground)  !important; }
.badge.bg-warning   { background-color: var(--warning-light) !important; color: var(--warning-foreground) !important; }
.badge.bg-info      { background-color: var(--info-light)    !important; color: var(--info-foreground)    !important; }
.badge.bg-primary   { background-color: var(--ink)           !important; color: var(--ink-contrast)       !important; }
.badge.bg-secondary,
.badge.bg-light     { background-color: var(--muted)         !important; color: var(--muted-foreground)   !important; }
.badge.bg-dark      { background-color: var(--ink)           !important; color: var(--ink-contrast)       !important; }
.badge.text-dark    { color: inherit !important; }
.bg-light  { background-color: var(--muted) !important; }
.bg-white  { background-color: var(--card) !important; }
.text-muted { color: var(--muted-foreground) !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--border) !important; }

/* --- Bootstrap alert → 얇은 테두리 + 옅은 바탕 --- */
.alert {
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: var(--text-sm);
    padding: 12px 16px;
    line-height: 1.6;
}
.alert-info      { background: var(--info-light);    color: var(--info-foreground);    border-color: rgba(58, 102, 196, 0.18); }
.alert-success   { background: var(--success-light); color: var(--success-foreground); border-color: rgba(31, 138, 91, 0.18); }
.alert-warning   { background: var(--warning-light); color: var(--warning-foreground); border-color: rgba(194, 122, 18, 0.20); }
.alert-danger    { background: var(--danger-light);  color: var(--danger-foreground);  border-color: rgba(214, 69, 69, 0.18); }
.alert-secondary,
.alert-light     { background: var(--muted);         color: var(--muted-foreground);   border-color: var(--border-light); }
.alert a { color: inherit; font-weight: var(--font-semibold); }

/* --- 페이지네이션 — 테두리 없는 둥근 칸, 현재 페이지는 먹색 --- */
.pagination { gap: 4px; --bs-pagination-focus-box-shadow: 0 0 0 3px rgba(22, 21, 19, 0.10); }
.page-link {
    border: none !important;
    border-radius: 8px !important;
    min-width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 10px;
    font-size: var(--text-sm); font-weight: var(--font-medium);
    color: var(--muted-foreground);
    background: transparent;
    font-variant-numeric: tabular-nums;
}
.page-link:hover { background: var(--muted); color: var(--foreground); }
.page-item.active .page-link { background: var(--ink); color: var(--ink-contrast); font-weight: var(--font-semibold); }
.page-item.disabled .page-link { background: transparent; color: var(--muted-foreground-3); }

/* --- 드롭다운 --- */
.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    font-size: var(--text-sm);
    background: var(--card);
}
.dropdown-item { border-radius: 8px; padding: 8px 10px; color: var(--foreground); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--muted); color: var(--foreground); }
.dropdown-item.active, .dropdown-item:active { background: var(--ink); color: var(--ink-contrast); }

/* --- 체크박스 / 스위치 / 라디오 --- */
.form-check-input { border-color: #cfcac0; }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
.form-check-input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22, 21, 19, 0.10); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); }
.form-text, small.text-muted { color: var(--muted-foreground-2) !important; }

/* --- 입력 그룹 / 진행바 / 스피너 / 리스트 --- */
.input-group-text { background: var(--muted); border-color: var(--input); color: var(--muted-foreground); border-radius: var(--radius-md); }
.progress { background: var(--muted); border-radius: var(--radius-full); }
.progress-bar { background-color: var(--ink); }
.spinner-border { color: var(--muted-foreground-3); border-width: 2px; }
.list-group-item { border-color: var(--border-light); }

/* --- 스크롤바 (WebKit + Firefox) --- */
* { scrollbar-color: #d6d1c7 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d6d1c7; border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #bdb7ab; }
::-webkit-scrollbar-track { background: transparent; }

/* --- 키보드 포커스 표시 (마우스 클릭엔 안 보임) --- */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--ink); outline-offset: 2px;
}
/* 모달·알림창 자체(tabindex=-1)는 포커스를 받아도 화면 테두리 선을 그리지 않음 */
.modal:focus-visible, .swal2-popup:focus-visible { outline: none; }

/* --- 금액 지표 카드 (라벨 + N원 + N건) — dashboard 홈 "오늘 결제 현황" · 그룹 전체 현황 공용 ---
 * 2026-10-19 dashboard/index.jsp 인라인에서 이동 (그룹 현황은 같은 클래스를 쓰면서 스타일이 없어 맨 글자로 보였음).
 * .today-metric-primary = 페이지에서 가장 중요한 숫자(받은 돈) — 먹색 카드 */
.today-metric {
    padding: var(--space-4) var(--space-4);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: box-shadow var(--transition-fast);
}
.today-metric:hover { box-shadow: var(--shadow-md); }
.today-metric-label {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    font-weight: var(--font-medium);
}
.today-metric-amount {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    line-height: 1.2;
    letter-spacing: -0.01em;
    word-break: break-all;
    font-variant-numeric: tabular-nums;
    /* color 은 .value-* 클래스 또는 .today-metric-primary 에서 설정 (cascade 충돌 방지) */
    color: var(--foreground);
}
/* value-* 인라인 클래스가 amount 의 색을 덮어쓰도록 specificity 보강 */
.today-metric-amount.value-success  { color: var(--success-foreground); }
.today-metric-amount.value-danger   { color: var(--danger-foreground); }
.today-metric-amount.value-warning  { color: var(--warning-foreground); }
.today-metric-amount.value-brand    { color: var(--brand-primary); }
.today-metric-amount.txt-muted      { color: var(--muted-foreground); }
.today-metric-count {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    margin-top: 2px;
}
.today-metric-primary {
    background: var(--ink);
    border-color: var(--ink);
}
.today-metric-primary .today-metric-label,
.today-metric-primary .today-metric-count { color: rgba(255, 255, 255, 0.62); }
.today-metric-primary .today-metric-label .txt-muted { color: rgba(255, 255, 255, 0.45) !important; }
.today-metric-primary .today-metric-amount { color: var(--ink-contrast); }
html[data-theme="dark"] .today-metric-primary .today-metric-label,
html[data-theme="dark"] .today-metric-primary .today-metric-count { color: rgba(22, 21, 19, 0.6); }
html[data-theme="dark"] .today-metric-primary .today-metric-label .txt-muted { color: rgba(22, 21, 19, 0.45) !important; }

/* --- 대시보드 상단바 폰 폭 — 지점 선택·역할 배지·이름·로그아웃이 한 줄에 다 안 들어감 (GROUP) --- */
@media (max-width: 576px) {
    .payvit-topbar .topbar-role-badge,
    .payvit-topbar .topbar-user-group,
    .payvit-topbar .page-description { display: none !important; }
    .payvit-topbar .topbar-user-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
    .payvit-topbar .ms-auto.gap-3 { gap: var(--space-2) !important; min-width: 0; }
}

/* --- 통계 카드 hover — 선만 살짝 진하게 --- */
.stat-card[onclick]:hover,
.stat-card.stat-card-link:hover { border-color: var(--input); box-shadow: var(--shadow-md); }

/* --- 다크 모드 보정 (위 레이어의 고정값) --- */
html[data-theme="dark"] .table > thead.table-light th,
html[data-theme="dark"] .table > :not(caption) > * > .table-light { background: var(--muted) !important; }
html[data-theme="dark"] .table { --bs-table-striped-bg: #1f1d1b; }
html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-dark:hover,
html[data-theme="dark"] .btn-light:hover { border-color: var(--border) !important; }
html[data-theme="dark"] * { scrollbar-color: #3a3733 transparent; }
/* 다크: --ink 가 밝은색이라 Bootstrap 의 흰 체크 표시가 안 보임 → 체크된 상태는 핑크 바탕 */
html[data-theme="dark"] .form-check-input { border-color: #4a4641; }
html[data-theme="dark"] .form-check-input:checked { background-color: var(--brand-primary); border-color: var(--brand-primary); }
html[data-theme="dark"] input[type="checkbox"], html[data-theme="dark"] input[type="radio"] { accent-color: var(--brand-primary); }
html[data-theme="dark"] .stat-card[onclick]:hover,
html[data-theme="dark"] .stat-card.stat-card-link:hover { border-color: #3a3733; }
/* 다크: 로고 마크의 남색 타일이 어두운 사이드바에 묻히지 않게 얇은 테두리 */
html[data-theme="dark"] .sidebar-brand__mark { border-radius: 7px; box-shadow: 0 0 0 1px #3a3733; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background-color: #3a3733; }

/* ===========================================================================
 * 알림창 · 확인창 · 입력창 (SweetAlert2 테마) + 토스트 — payvit-ui.js 와 한 세트
 *
 *   pvAlert('저장되었습니다.')                 → 확인 버튼 하나
 *   pvConfirm('삭제할까요?', {danger:true})     → Promise<boolean>
 *   pvPrompt('사유를 입력해주세요')              → Promise<string|null>
 *   pvToast('복사했습니다', 'success')          → 자동으로 사라지는 알림
 * =========================================================================== */
.swal2-container.pv-swal { padding: 16px; }
/* SweetAlert2 기본은 알림창이 뜨면 body 스크롤을 숨김 → 스크롤바가 사라져 화면이 17px 옆으로 밀림.
 * payvit-ui.js 가 scrollbarPadding:false 로 보정을 끄므로 여기서 스크롤 숨김도 끈다 (뒤 화면은 반투명 막이 가려 클릭 불가).
 * Bootstrap 모달이 열려 있을 때(.modal-open)는 Bootstrap 의 인라인 overflow:hidden 이 그대로 적용됨. */
html body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown):not(.modal-open) { overflow: visible; }
.swal2-container.pv-swal.swal2-backdrop-show { background: rgba(22, 21, 19, 0.32); }
.pv-swal .swal2-popup {
    width: 400px; max-width: 100%;
    padding: 24px 24px 20px;
    border-radius: 18px;
    background: var(--card);
    color: var(--foreground);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    font-family: var(--font-sans);
    text-align: left;
}
.pv-swal .swal2-icon { display: none !important; }
.pv-swal .pv-swal-mark {
    width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; margin: 0 0 14px;
}
.pv-swal .pv-swal-mark.info    { background: var(--muted);         color: var(--foreground); }
.pv-swal .pv-swal-mark.success { background: var(--success-light); color: var(--success-foreground); }
.pv-swal .pv-swal-mark.warning { background: var(--warning-light); color: var(--warning-foreground); }
.pv-swal .pv-swal-mark.danger  { background: var(--danger-light);  color: var(--danger-foreground); }
.pv-swal .swal2-title {
    padding: 0; margin: 0 0 6px;
    font-size: 17px; font-weight: var(--font-bold); letter-spacing: -0.02em;
    color: var(--foreground); text-align: left; line-height: 1.4;
}
.pv-swal .swal2-html-container {
    margin: 0; padding: 0;
    font-size: var(--text-base); line-height: 1.65;
    color: var(--muted-foreground); text-align: left;
    white-space: pre-line; word-break: keep-all; overflow-wrap: anywhere;
}
/* 제목 없이 본문만 있을 때 — 본문을 제목처럼 진하게 */
.pv-swal .swal2-popup.pv-swal-plain .swal2-html-container { color: var(--foreground); font-size: 15px; font-weight: var(--font-medium); }
.pv-swal .swal2-input, .pv-swal .swal2-textarea {
    width: 100%; margin: 14px 0 0; box-sizing: border-box;
    border: 1px solid var(--input); border-radius: var(--radius-md);
    padding: 10px 13px; height: auto; font-size: var(--text-base);
    color: var(--foreground); background: var(--card); box-shadow: none;
}
.pv-swal .swal2-input:focus, .pv-swal .swal2-textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22, 21, 19, 0.08); }
.pv-swal .swal2-validation-message { background: transparent; color: var(--danger-foreground); font-size: var(--text-sm); justify-content: flex-start; margin: 8px 0 0; padding: 0; }
.pv-swal .swal2-validation-message::before { display: none; }
.pv-swal .swal2-actions {
    width: 100%; margin: 22px 0 0; padding: 0;
    display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 8px;
}
.pv-swal .swal2-actions button {
    margin: 0; min-width: 84px; height: 40px; padding: 0 16px;
    border-radius: var(--radius-md); font-size: var(--text-base); font-weight: var(--font-semibold);
    font-family: var(--font-sans); box-shadow: none !important; border: 1px solid transparent;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
}
.pv-swal .swal2-actions button:active { transform: var(--tap-scale); }
.pv-swal .swal2-confirm { background: var(--ink) !important; color: var(--ink-contrast) !important; }
.pv-swal .swal2-confirm:hover { background: var(--ink-hover) !important; }
.pv-swal .swal2-confirm.pv-danger { background: var(--danger) !important; color: #fff !important; }
.pv-swal .swal2-confirm.pv-danger:hover { background: var(--danger-foreground) !important; }
.pv-swal .swal2-cancel { background: var(--card) !important; color: var(--foreground) !important; border-color: var(--border) !important; }
.pv-swal .swal2-cancel:hover { background: var(--muted) !important; }
.pv-swal .swal2-actions button:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(22, 21, 19, 0.16) !important; }
.pv-swal .swal2-actions .swal2-confirm.pv-danger:focus-visible { box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.25) !important; }
.pv-swal .swal2-show { animation: pvPop 0.32s var(--ease-out); }
.pv-swal .swal2-hide { animation: pvFade 0.15s ease forwards; }
@keyframes pvPop  { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes pvFade { to { opacity: 0; transform: scale(0.98); } }
@media (max-width: 576px) {
    .pv-swal .swal2-actions button { flex: 1; }
}

/* 토스트 — 화면 위 가운데, 먹색 알약 + 왼쪽 상태 아이콘 */
.pv-toast-stack {
    position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
    z-index: 2000; display: flex; flex-direction: column; align-items: center; gap: 8px;
    pointer-events: none; width: max-content; max-width: calc(100vw - 32px);
}
.pv-toast {
    pointer-events: auto; cursor: pointer;
    display: flex; align-items: flex-start; gap: 10px;
    min-width: 220px; max-width: 440px;
    padding: 12px 16px 12px 14px;
    background: #161513; color: #f2efe9;
    border-radius: 14px;
    box-shadow: 0 16px 36px -10px rgba(22, 21, 19, 0.45);
    font-size: var(--text-base); font-weight: var(--font-medium); line-height: 1.5;
    white-space: pre-line; word-break: keep-all;
    animation: pvToastIn 0.4s var(--ease-out);
}
html[data-theme="dark"] .pv-toast { background: #2a2825; border: 1px solid #3a3733; }
.pv-toast.hide { animation: pvToastOut 0.2s ease forwards; }
.pv-toast i { font-size: 17px; line-height: 1.35; flex: none; }
.pv-toast.success i { color: #5cc794; }
.pv-toast.danger  i { color: #f2807c; }
.pv-toast.warning i { color: #e3a94f; }
.pv-toast.info    i { color: #b4afa6; }
@keyframes pvToastIn  { from { opacity: 0; transform: translateY(-10px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes pvToastOut { to { opacity: 0; transform: translateY(-6px); } }

/* --- 표 안의 ID(code) — 행마다 핑크면 화면이 핑크로 뒤덮임. 표에서는 먹색 계열로, 핑크는 포인트에만 --- */
.table code { color: var(--muted-foreground); }

/* --- 대시보드 GROUP: 상단바 왼쪽 "지점" 선택 — 지금 어느 지점을 보고 있는지 첫눈에 (2026-10-19) --- */
.topbar-branch {
    display: flex; align-items: center; gap: 10px;
    min-width: 0;
    margin-right: var(--space-4);
}
.topbar-branch__label {
    display: inline-flex; align-items: center; gap: 5px;
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--brand-primary-light);
    color: var(--brand-ink);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
}
.topbar-branch__select.form-select {
    width: auto; max-width: 360px; min-width: 0;
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--foreground);
    padding: 6px 40px 6px 12px;
    border-color: var(--border);
    text-overflow: ellipsis;
}
@media (max-width: 576px) {
    .topbar-branch { margin-right: var(--space-2); gap: 6px; }
    .topbar-branch__label { display: none; }
    .topbar-branch__select.form-select { font-size: var(--text-md); max-width: 58vw; padding-right: 32px; }
}

/* =====================================================================
   온보딩 안내 컴포넌트 (2026-10-21 온보딩 재설계, docs/onboarding-process.md)
   "처음 온 사람도 화면만 보고 다음에 무엇을, 왜 하는지 알게" — 큰 글자 · 번호 단계 · 한 단계에 버튼 하나
   사용처: sandbox/convert.jsp (유형 선택), dashboard/index.jsp (결제 시작하기),
          dashboard/group/index.jsp (API 연동 시작하기), dashboard/point/index.jsp (포인트 안내)
   ===================================================================== */
.pv-onboard {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
}
.pv-onboard__title { font-size: var(--text-xl); font-weight: var(--font-bold); margin: 0 0 var(--space-2); line-height: 1.35; }
.pv-onboard__lead  { font-size: var(--text-md); color: var(--muted-foreground); margin: 0 0 var(--space-5); line-height: 1.65; }

/* 번호 단계 — 지난 단계 ✓ / 지금 단계(먹색 원 + 버튼) / 다음 단계(흐리게) */
.pv-steps { list-style: none; margin: 0; padding: 0; }
.pv-step { display: flex; gap: var(--space-4); padding: var(--space-4) 0; border-top: 1px solid var(--border-light); }
.pv-step:first-child { border-top: none; padding-top: 0; }
.pv-step__num {
    flex: none; width: 40px; height: 40px; border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    font-size: var(--text-lg); font-weight: var(--font-bold);
    background: var(--surface-2); color: var(--muted-foreground-2); border: 1px solid var(--border);
}
.pv-step__body { flex: 1; min-width: 0; }
.pv-step__title { font-size: var(--text-lg); font-weight: var(--font-semibold); margin: 6px 0 4px; line-height: 1.4; }
.pv-step__desc  { font-size: var(--text-base); color: var(--muted-foreground); margin: 0; line-height: 1.65; }
.pv-step__action { margin-top: var(--space-3); display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.pv-step__action .btn { font-size: var(--text-md); padding: 10px 20px; }
.pv-step.is-done .pv-step__num { background: var(--success-light); color: var(--success); border-color: transparent; }
.pv-step.is-done .pv-step__title { color: var(--muted-foreground); }
.pv-step.is-now  .pv-step__num { background: var(--ink); color: var(--ink-contrast); border-color: var(--ink); }
.pv-step.is-todo .pv-step__title, .pv-step.is-todo .pv-step__desc { color: var(--muted-foreground-2); }

/* 큰 선택 카드 (유형 고르기) — 아이콘 + 제목 + 한 줄 설명 */
.pv-choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
.pv-choice {
    display: flex; flex-direction: column; gap: var(--space-2); text-align: left;
    padding: var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-lg);
    background: var(--card); color: var(--foreground); cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.pv-choice:hover { border-color: var(--muted-foreground-3); }
.pv-choice.is-selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.pv-choice__icon { font-size: 32px; color: var(--brand-primary); line-height: 1; }
.pv-choice__title { font-size: var(--text-lg); font-weight: var(--font-bold); }
.pv-choice__desc  { font-size: var(--text-base); color: var(--muted-foreground); line-height: 1.55; }
@media (max-width: 576px) { .pv-choice-grid { grid-template-columns: 1fr; } }

/* "왜 필요한가요?" — 돈·절차의 이유를 한 줄로 */
.pv-why {
    display: flex; gap: var(--space-3); align-items: flex-start;
    background: var(--surface-2); border: 1px solid var(--border-light); border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4); margin-top: var(--space-4);
    font-size: var(--text-base); color: var(--muted-foreground); line-height: 1.6;
}
.pv-why > i { font-size: 20px; color: var(--brand-primary); flex: none; margin-top: 1px; }
.pv-why strong { color: var(--foreground); }

/* 금액 강조 (가입비 55,000원 등) */
.pv-money { font-size: var(--text-xl); font-weight: var(--font-bold); color: var(--foreground); }
.pv-money small { font-size: var(--text-sm); font-weight: var(--font-medium); color: var(--muted-foreground); margin-left: 4px; }

/* 아이콘 타일 3칸 (포인트가 쓰이는 곳 등) */
.pv-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.pv-tile { background: var(--surface-2); border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: var(--space-4); }
.pv-tile > i { font-size: 26px; color: var(--brand-primary); display: block; margin-bottom: var(--space-2); }
.pv-tile__title { font-size: var(--text-md); font-weight: var(--font-semibold); margin-bottom: 2px; }
.pv-tile__desc  { font-size: var(--text-base); color: var(--muted-foreground); line-height: 1.55; }
@media (max-width: 768px) { .pv-tiles { grid-template-columns: 1fr; } }
@media (max-width: 576px) { .pv-onboard { padding: var(--space-5) var(--space-4); } .pv-step { gap: var(--space-3); } }

/* 온보딩 가시성 (2026-10-21) — 강조는 "지금 단계 상자" 하나만. 지난 단계는 한 줄, 다음 단계는 제목만 */
.pv-step.is-now {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: var(--space-5);
    margin: var(--space-2) 0;
}
.pv-step.is-now + .pv-step { border-top: none; }
.pv-step__hint { font-size: var(--text-sm); color: var(--muted-foreground); margin: var(--space-2) 0 0; line-height: 1.6; }
.pv-step:not(.is-now) .pv-step__hint { display: none; }
.pv-step.is-now .pv-step__action .btn-dark { font-size: var(--text-md); padding: 12px 24px; font-weight: var(--font-semibold); }

/* 결제 시작하기 카드 — 지난 단계는 작게 한 줄, 다음 단계는 설명 숨김 */
.pv-onboard--compact .pv-step.is-done { padding: var(--space-2) 0; align-items: center; }
.pv-onboard--compact .pv-step.is-done .pv-step__num { width: 28px; height: 28px; font-size: var(--text-sm); }
.pv-onboard--compact .pv-step.is-done .pv-step__title { font-size: var(--text-base); margin: 0; }
.pv-onboard--compact .pv-step.is-done .pv-step__desc { display: none; }
.pv-onboard--compact .pv-step.is-todo .pv-step__desc { display: none; }
.pv-onboard--compact .pv-step.is-todo { align-items: center; }
.pv-onboard--compact .pv-step.is-todo .pv-step__title { margin: 0; }

/* "왜 내나요?" 접기 — 궁금한 사람만 펼침 */
.pv-why-fold { margin-top: var(--space-4); font-size: var(--text-sm); color: var(--muted-foreground); }
.pv-why-fold summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; list-style: none; }
.pv-why-fold summary::-webkit-details-marker { display: none; }
.pv-why-fold summary:hover { color: var(--foreground); }
.pv-why-fold p { margin: var(--space-2) 0 0; line-height: 1.65; }
@media (max-width: 576px) {
    .pv-step.is-now { padding: var(--space-4); }
    .pv-step.is-now .pv-step__action .btn-dark { width: 100%; }
}

/* 빈 상태 안내 카드 (2026-10-21) — 고를 대상이 없을 때 빈 폼·"로딩 중" 대신. 아이콘 + 제목 + 쉬운 설명 + 다음 할 일 버튼 */
.pv-empty-note { display: flex; gap: var(--space-4); align-items: flex-start; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: var(--space-6); margin-bottom: var(--space-6); }
.pv-empty-note > i { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); color: var(--muted-foreground);
    display: flex; align-items: center; justify-content: center; font-size: 20px; }
.pv-empty-note__title { font-size: var(--text-md); font-weight: var(--font-semibold); color: var(--foreground); margin-bottom: 4px; }
.pv-empty-note__desc { font-size: var(--text-sm); color: var(--muted-foreground); line-height: 1.65; }

/* 상단바 이름 = "내 정보" 버튼 (2026-10-21) */
.topbar-user--btn { background: none; border: 1px solid transparent; border-radius: var(--radius-md); padding: 4px 8px; cursor: pointer; color: inherit; font: inherit; }
.topbar-user--btn:hover { background: var(--surface-2); border-color: var(--border); }
.topbar-user__caret { font-size: 11px !important; color: var(--muted-foreground); }
