/* ======================================================================
   app.css — 이 앱의 껍데기만. 그리드 키트(gridkit.css)와 섞지 않는다.
   사이드바 / 사이드바 메뉴 계층 / 대시보드 / 로그인
   ====================================================================== */
/* ---------- 사이드바 접기/펼치기 (§2.8 ⑤) ---------- */
#adminSidebar { transition: margin-left .2s ease; }
body.sidebar-collapsed #adminSidebar { margin-left: -15rem; }   /* w-60 = 15rem 슬라이드 아웃 */
/* 가장자리 핸들: 펼침=사이드바 경계(좌측만 둥글게, 어두운 탭+흰 화살표) / 접힘=화면 왼쪽 끝(우측만 둥글게, 흰 배경+검은 화살표) */
#sidebarHandle { left: calc(15rem - 24px); border-radius: 8px 0 0 8px; box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
    background: #1e293b !important; color: #ffffff !important; transition: left .2s ease, background .2s ease, color .2s ease; }
#sidebarHandle svg { display: block; transition: transform .2s ease; }
body.sidebar-collapsed #sidebarHandle { left: 0; border-radius: 0 8px 8px 0; background: #ffffff !important; color: #111827 !important; border: 1px solid #e2e8f0; }
body.sidebar-collapsed #sidebarHandle svg { transform: scaleX(-1); }   /* 닫힘 = 오른쪽(›) 화살표 */

/* 사이드바 메뉴 스크롤바: 얇고 은은하게(다크 배경) */
#adminSidebar nav { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .2) transparent; padding-bottom: 48px; }   /* §2.8⑦ 하단 여유 — 맨 아래 메뉴/그룹 펼침 공간 */
#adminSidebar nav::-webkit-scrollbar { width: 6px; }
#adminSidebar nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 3px; }
#adminSidebar nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .32); }
#adminSidebar nav::-webkit-scrollbar-track { background: transparent; }
/* 본문 스크롤바: 얇게 */
main { scrollbar-width: thin; scrollbar-color: rgba(100, 116, 139, .35) transparent; }
main::-webkit-scrollbar { width: 8px; }
main::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, .3); border-radius: 4px; }
main::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, .5); }
main::-webkit-scrollbar-track { background: transparent; }

/* ---------- 사이드바 메뉴 계층 (§2.8 ⑦: 0뎁스 그룹 / 1뎁스 리프) ---------- */
.nav-link, .nav-group-head { display: flex; align-items: center; gap: 6px; width: 100%; font-size: 14px; color: #cbd5e1; line-height: 1.2; text-align: left; }
.nav-group-head { padding: 10px 16px; }                  /* 1뎁스 그룹: 라벨 16px (꺽쇠 우측) */
.nav-top { padding: 10px 16px; }                          /* 1뎁스 독립 리프(대시보드): 그룹헤더와 동일 16px (꺽쇠 우측 이동) */
.nav-leaf { padding: 9px 16px 9px 36px; }                /* 2뎁스 리프: 1뎁스(16) + 20 들여쓰기 */
.nav-link:hover, .nav-group-head:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.is-active { background: #1e293b; color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 0 #10b981; }
.nav-link.is-active .nav-label { color: #fff; }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* 말줄임 */
/* 꺽쇠 = 행 오른쪽 끝(ADMIN_PAGE_RULE §2.8⑦) */
.nav-chevron { order: 9; margin-left: auto; width: 14px; height: 14px; flex-shrink: 0; transition: transform .15s; color: #64748b; }
.nav-mini-btn { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: #94a3b8; }
.nav-mini-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-mini-btn svg { width: 16px; height: 16px; }
.nav-group.is-open > .nav-group-head .nav-chevron { transform: rotate(90deg); }
.nav-group-body { display: none; }
.nav-group.is-open > .nav-group-body { display: block; }
/* 커스텀 툴팁 (네이티브 title 금지, 지연 0) */
.nav-tooltip { position: fixed; z-index: 200; transform: translateY(-50%); background: #fff; color: var(--primary); border: 1px solid var(--primary); font-size: 12px;
    padding: 4px 9px; border-radius: 6px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .07s; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }
.nav-tooltip.show { opacity: 1; }
/* §2.5 그리드 셀 말줄임 커스텀 툴팁 (커서 추종, 긴 내용은 줄바꿈) */
.admin-celltip { position: fixed; z-index: 200; transform: translateY(-50%); background: #fff; color: var(--primary); border: 1px solid var(--primary); font-size: 12px;
    padding: 5px 9px; border-radius: 6px; max-width: 60vw; white-space: normal; word-break: break-word; line-height: 1.4;
    pointer-events: none; opacity: 0; transition: opacity .07s; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }
.admin-celltip.show { opacity: 1; }
/* §전역 커스텀 툴팁(네이티브 title 대체, 커서 추종) — 버튼/로고/드래그핸들 등 */
.admin-tip { position: fixed; z-index: 250; transform: translateY(-50%); background: #fff; color: var(--primary); border: 1px solid var(--primary); font-size: 12px;
    padding: 4px 9px; border-radius: 6px; max-width: 50vw; white-space: nowrap; pointer-events: none; opacity: 0;
    transition: opacity .07s; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }
.admin-tip.show { opacity: 1; }

/* ============================================================
   colon-money 추가분 — 공통 컴포넌트(§1.6 atom/molecule) 확장
   화면 JTE 에 인라인 <style> 을 두지 않기 위해 전부 여기에 둔다.
   ============================================================ */

/* ---------- 대시보드 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: block; transition: all .15s; }
a.stat-card:hover { background: var(--primary); border-color: var(--primary); }
a.stat-card:hover .stat-label, a.stat-card:hover .stat-value, a.stat-card:hover .stat-sub { color: #fff; }
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat-label::before { content: ""; width: 4px; height: 13px; border-radius: 2px; background: var(--primary); }
.stat-value { font-size: 26px; font-weight: 800; color: var(--primary); line-height: 1.25; margin-top: 8px; }
.stat-value .unit { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-left: 3px; }
.stat-sub { font-size: 11px; color: var(--text-secondary); margin-top: 3px; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-head { padding: 13px 18px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.panel-head::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--primary); }
.mini-table { width: 100%; border-collapse: collapse; }
.mini-table th { background: #f8fafc; font-size: 11px; font-weight: 600; color: var(--text-secondary); padding: 8px 14px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
.mini-table td { font-size: 12.5px; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-primary); white-space: nowrap; }
.mini-table tr:last-child td { border-bottom: none; }
.mini-table tbody tr:hover td { background: var(--primary-light); }
/* 숫자는 자릿수가 세로로 맞아야 대소가 눈에 들어온다(tabular-nums) + 본문보다 크고 진하게 */
.mini-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mini-table td.amt { font-size: 14.5px; font-weight: 700; color: var(--primary); letter-spacing: -.01em; }
.mini-table td.amt .cur { font-size: 10.5px; font-weight: 600; color: var(--text-secondary); margin-left: 2px; }
.mini-table td.cnt { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.mini-table td.cnt .unit { font-size: 10.5px; font-weight: 500; color: var(--text-secondary); margin-left: 1px; }
.mini-table td.ym { font-size: 12.5px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.mini-table td.amt.zero { color: var(--text-secondary); font-weight: 500; }   /* 0 은 눈에 덜 걸리게 */
.mini-empty { padding: 26px 14px; text-align: center; color: var(--text-secondary); font-size: 13px; }

/* ---------- 로그인 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: #0f172a; position: relative; }
.login-card { width: 100%; max-width: 360px; background: #fff; border-radius: 16px; padding: 34px 30px 30px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.login-logo { font-size: 21px; font-weight: 800; color: #0f172a; letter-spacing: -.02em; text-align: center; }
.login-logo span { color: #64748b; font-weight: 700; }
.login-form { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.login-form .filter-input { height: 44px; font-size: 14px; }
.login-form .btn { height: 44px; justify-content: center; font-size: 14px; }
.login-error { font-size: 12.5px; color: var(--danger); font-weight: 600; text-align: center; }
.login-version { position: fixed; left: 16px; bottom: 12px; font-size: 11px; color: rgba(255, 255, 255, .45); }

/* 모바일: 사이드바 = 오프캔버스 드로어 (키트가 아니라 앱 껍데기다) */
@media (max-width: 768px) {
    /* ----- 사이드바 = 오프캔버스 드로어 ----- */
    #adminSidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100%; z-index: 60; margin-left: 0 !important; transform: translateX(0); transition: transform .22s ease; }
    body.sidebar-collapsed #adminSidebar { transform: translateX(-100%); }
    #sidebarBackdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
    body:not(.sidebar-collapsed) #sidebarBackdrop { opacity: 1; pointer-events: auto; }

    /* 모바일: 가장자리 핸들 대신 우하단 햄버거 FAB */
    #sidebarHandle { display: none; }
    #sidebarFab {
        display: flex; align-items: center; justify-content: center;
        position: fixed; right: 16px; bottom: 16px; z-index: 65;
        width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
        background: #111827; color: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
    }
    #sidebarFab:active { transform: scale(.94); }
}

/* 데스크탑에서는 오프캔버스 보조요소를 숨긴다(가장자리 핸들 사용) */
#sidebarBackdrop { display: none; }
#sidebarFab { display: none; }
