/* ============================================
   NFP 푸드트럭 관리 시스템 — 메인 CSS
   모바일 퍼스트 / 라이트-다크 테마
   Apple + Sci-Fi 미니멀 스타일
   ============================================ */

/* --- CSS 변수 (라이트 테마) --- */
:root {
    --bg:          #f4f5f7;
    --surface:     #ffffff;
    --border:      #e5e6ea;
    --text:        #1d1d1f;
    --text-sub:    #6e6e73;
    --primary:     #0071e3;
    --primary-dk:  #0058b0;
    --success:     #16b364;
    --warn:        #ff9f0a;
    --danger:      #ff3b30;
    /* 모서리 — 한 단계씩만 (칩/작은버튼 8 · 카드/입력 12 · 모달 16) */
    --radius:      12px;
    --radius-sm:   8px;
    --radius-lg:   16px;
    /* 그림자 — 카드는 '테두리 + 아주 옅은 그림자'로 눌러두고,
       진짜 떠 있는 것(모달·팝오버·드롭다운)에만 --shadow-lg 를 쓴다.
       색 있는 글로우는 쓰지 않는다(브랜드색과 액션색이 다른 화면에서 튄다). */
    --shadow:      0 1px 2px rgba(16,24,40,.04);
    --shadow-lg:   0 8px 28px rgba(16,24,40,.12);
    --nav-h:       52px;
    --font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Pretendard', 'Apple SD Gothic Neo',
                   'Malgun Gothic', sans-serif;
}

/* --- 다크 테마 (Sci-Fi 고대비) --- */
.theme-dark {
    --bg:          #000000;
    --surface:     #1c1c1e;
    --border:      #38383a;
    --text:        #f5f5f7;
    --text-sub:    #aeaeb2;
    --primary:     #0a84ff;
    --primary-dk:  #0071e3;
    --success:     #1ed17a;
    --warn:        #ffd60a;
    --danger:      #ff453a;
    --shadow:      0 1px 2px rgba(0,0,0,.4);
    --shadow-lg:   0 8px 28px rgba(0,0,0,.5);
}

/* --- 페이지 전환 깜빡임 억제 (View Transitions) ---
   메뉴 클릭 = 전체 페이지 새 로드(MPA)라 매번 상단바·사이드바가 다시 그려지며 깜빡인다.
   같은 출처 문서 간 전환을 이어 그리게 하고, 상단바·사이드바는 별도 스냅샷으로 분리해
   내용이 같으면 화면에 고정된 것처럼 보이게 한다. 미지원 브라우저는 무시(기존 동작 유지).
   (모바일에선 .pc-topbar/.sidebar 가 display:none 이라 스냅샷에서 빠진다 — 이름 충돌 없음) */
@view-transition { navigation: auto; }
.pc-topbar { view-transition-name: pc-topbar; }
.sidebar   { view-transition-name: pc-sidebar; }
/* 본문 크로스페이드는 기본(0.25s)이면 어중간하게 흐릿하다 — 짧게 끊는다 */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .12s; }

/* --- 리셋 & 기본 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* scrollbar-gutter: 스크롤바 자리를 늘 비워둔다.
   없으면 내용이 짧아 스크롤바가 안 생기는 화면만 본문이 스크롤바 폭(약 15px)만큼 넓어져,
   사이드바로 화면을 옮길 때마다 좌우가 살짝 늘었다 줄었다 한다.
   (모바일은 오버레이 스크롤바라 폭이 0 → 영향 없음) */
/* height:100% 를 주면 body 가 '화면 높이'에서 끝나고 내용은 그 밖으로 넘친다 →
   sticky 상단바가 body 경계를 지나는 순간 같이 밀려 올라가고 그 자리가 빈다.
   문서 전체 높이를 갖도록 min-height 만 준다. */
html { font-size: 16px; -webkit-tap-highlight-color: transparent; min-height: 100%; scrollbar-gutter: stable; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background .25s, color .25s;
    /* 표 행 구분선 — 행을 촘촘하게 두면 --border 실선은 줄무늬처럼 시끄러워진다.
       테마 클래스(.theme-dark)와 같은 요소에 선언해야 다크에서도 제 색으로 풀린다. */
    --row-line: color-mix(in srgb, var(--border) 60%, transparent);
}
a { color: var(--primary); text-decoration: none; }
/* 폼 컨트롤 전역 컴팩트 — 16px/44px 기본은 ERP 표·필터 줄에서 너무 컸다(옵션 글자 포함).
   로그인 등 큰 입력이 필요한 화면은 자체 클래스(.auth-field input)로 키운다. */
input, textarea, button, select { font-family: inherit; font-size: .875rem; }
input, textarea, select {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    /* 세로 패딩 축소 — 입력칸 높이가 행 높이를 끌어올리던 문제(2026-08-05).
       단 0에 가깝게 줄였더니 입력칸이 셀보다 작아져 테두리 위아래에 빈 공간이 생겼다 → 5px 로 되돌림. */
    padding: 5px 9px;
    width: 100%;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

/* ── 셀렉트 박스 통일 (커스텀 화살표) ── */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    height: 30px;
    padding: 4px 28px 4px 9px;
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%236e6e73' d='M1 1l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 11px;
}
.theme-dark select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23aeaeb2' d='M1 1l5 5 5-5'/></svg>");
}
select.select-sm { height: 28px; padding: 3px 24px 3px 8px; font-size: .8rem; background-position: right 8px center; }
select:disabled { opacity: .55; cursor: not-allowed; }

/* ── 체크박스/라디오는 전역 input 규격(풀폭·패딩·테두리) 제외 ── */
input[type="checkbox"], input[type="radio"] {
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    -webkit-appearance: auto;
    appearance: auto;
    accent-color: var(--primary);
    cursor: pointer;
    flex: 0 0 auto;        /* flex 컨테이너 안에서 늘어나지 않게 */
    width: 18px;
    height: 18px;
}
input[type="checkbox"]:focus, input[type="radio"]:focus { box-shadow: none; }

/* --- 상단 네비 ---
   모바일에선 어느 화면이든 항상 위에 붙어 있어야 한다(뒤로가기·제목이 늘 손에 닿게).
   PC 는 사이드바가 그 역할을 하므로 고정하지 않는다(아래 1024px 블록에서 static). */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    /* background 가 불투명(--surface)이라 블러는 보이지도 않으면서 합성 레이어만 만든다 → 제거 */
}
.nav-logo { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.5px; display:flex; align-items:center;
    color: inherit; text-decoration: none; cursor: pointer; }
.nav-logo-img { height: 36px; width: 36px; object-fit: contain; border-radius: 8px; display: block; }
.nav-title { font-size: 1rem; font-weight: 600; }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-username { font-size: .85rem; color: var(--text-sub); }
.btn-back {
    font-size: 1.3rem;
    color: var(--primary);
    padding: 4px 8px;
    background: none;
    border: none;
    cursor: pointer;
}

/* --- 페이지 컨테이너 --- */
.page-container {
    padding: 16px;
    /* 1440 제한은 와이드 모니터에서 양옆을 놀렸다 — 표 열이 좌우로 퍼지도록 넉넉히 */
    max-width: 1720px;
    margin: 0 auto;
}
/* 데이터 테이블 페이지(회원/권한 관리 등) — 넓은 화면 여백 활용 */
.page-container--wide { max-width: 1720px; }
.page-title {
    font-size: 1.4rem; font-weight: 700; margin-bottom: 4px;
    padding-left: 12px; border-left: 3px solid var(--primary);
}
.page-subtitle { font-size: .85rem; color: var(--text-sub); margin: 0 0 4px 15px; }
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.page-header h2 {
    font-size: 1.3rem; font-weight: 700;
    padding-left: 11px; border-left: 3px solid var(--primary);
}

/* ── NFP 커스텀 버튼 시스템 ──
   라운드를 키우고(12px) 굵게(700) 잡아 아이콘 스프라이트와 톤을 맞추고,
   호버 시 살짝 떠오르고 눌렀을 때 확실히 눌리는 촉감으로 "제작사 고유 룩"을 표현한다.
   색은 유지 — 그라데이션·글로우 없이 단색 + 그림자만으로 입체감을 낸다. */
.nfp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 12px;
    padding: 10px 20px;
    font-size: .92rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: .1px;
    transition: transform .14s, box-shadow .14s, filter .14s, background .14s;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    position: relative;
}
.nfp-btn:hover   { transform: translateY(-1px); }
.nfp-btn:active  { transform: translateY(0) scale(.97); }
.nfp-btn--primary { background: var(--primary); color: #fff; box-shadow: 0 2px 10px color-mix(in srgb, var(--primary) 35%, transparent); }
.nfp-btn--primary:hover { background: var(--primary-dk); box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 45%, transparent); }
.nfp-btn--success { background: var(--success); color: #fff; box-shadow: 0 2px 10px color-mix(in srgb, var(--success) 35%, transparent); }
.nfp-btn--warn    { background: var(--warn);    color: #1a1000; }
.nfp-btn--danger  { background: var(--danger);  color: #fff; box-shadow: 0 2px 10px color-mix(in srgb, var(--danger) 35%, transparent); }
.nfp-btn--ghost {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.nfp-btn--ghost:hover { background: var(--bg); border-color: var(--text-sub); }
.nfp-btn--sm  { padding: 6px 14px; font-size: .82rem; border-radius: 9px; }
.nfp-btn--lg  { padding: 14px 28px; font-size: 1rem; border-radius: 14px; }
.nfp-btn--full { width: 100%; }

/* ── 레거시 btn-* 호환 (사이즈/톤 통일) ──
   .nfp-btn과 동일한 룩(라운드 12px·굵기 700·호버 리프트)을 공유 — 페이지마다 들쭉날쭉하던 것 정규화 */
.btn-primary, .btn-secondary, .btn-warn, .btn-danger, .btn-success, .btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border: none;
    border-radius: 12px;
    font-size: .92rem;
    font-weight: 700;
    line-height: 1;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .14s, box-shadow .14s, filter .14s, background .14s;
    -webkit-tap-highlight-color: transparent;
}
/* 버튼은 단색 — 그라데이션·컬러 글로우 없음(둘 다 화면을 낡아 보이게 하고, 색이 많아질수록 지저분해진다) */
.btn-primary   { background: var(--primary); color:#fff; box-shadow: 0 2px 10px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn-primary:hover { background: var(--primary-dk); transform: translateY(-1px); box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 45%, transparent); }
.btn-secondary { background: var(--surface); color: var(--text);
    border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); border-color: var(--text-sub); transform: translateY(-1px); }
.btn-ghost     { background: transparent; color: var(--text-sub);
    border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); transform: translateY(-1px); }
.btn-warn      { background: var(--warn); color:#1a1000; }
.btn-danger    { background: var(--danger); color:#fff; box-shadow: 0 2px 10px color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-success   { background: var(--success); color:#fff; box-shadow: 0 2px 10px color-mix(in srgb, var(--success) 35%, transparent); }
.btn-warn:hover, .btn-danger:hover, .btn-success:hover { filter: brightness(.94); transform: translateY(-1px); }
.btn-primary:active, .btn-secondary:active, .btn-warn:active, .btn-danger:active, .btn-success:active, .btn-ghost:active {
    transform: translateY(0) scale(.97);
}
.btn-logout    { display:inline-flex; align-items:center; justify-content:center;
    background: none; border: 1px solid var(--border); color: var(--text);
    border-radius: 9px; min-height: 34px; padding: 0 12px; cursor: pointer; font-size:.82rem;
    font-weight: 600; font-family: inherit; transition: background .12s; }
.btn-logout:hover { background: var(--bg); }
.btn-icon      { display:inline-flex; align-items:center; justify-content:center;
    width: 38px; height: 38px; background: none; border: none; font-size: 1.2rem;
    /* button 은 color 를 상속하지 않아 기본값(검정)이 된다 → 다크모드에서 아이콘이 안 보임. 테마색으로 고정 */
    color: var(--text);
    border-radius: 9px; cursor: pointer; transition: background .12s; }
.btn-icon:hover { background: var(--bg); }
.btn-full      { width: 100%; }
.btn-lg        { min-height: 50px; padding: 0 24px; font-size: 1rem; border-radius: 14px; }
.btn-sm        { min-height: 34px; padding: 0 12px; font-size: .82rem; border-radius: 9px; }
/* 작은 위험 버튼 (목록 내 삭제 등) — 통일 */
.btn-danger-sm, .btn-primary-sm, .btn-secondary-sm {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 34px; padding: 0 12px; border-radius: 9px;
    font-size: .82rem; font-weight: 700; font-family: inherit; cursor: pointer;
    border: none; -webkit-tap-highlight-color: transparent;
    white-space: nowrap;   /* 좁은 표 칸에서 '삭제'가 세로로 꺾이지 않게 */
    transition: transform .12s, filter .12s;
}
.btn-danger-sm    { background: rgba(255,59,48,.12); color: var(--danger); }
.btn-danger-sm:hover { background: rgba(255,59,48,.2); }
.btn-primary-sm   { background: var(--primary); color: #fff; }
.btn-secondary-sm { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-danger-sm:active, .btn-primary-sm:active, .btn-secondary-sm:active { transform: scale(.96); }
/* 눌림은 살짝만 — .96은 버튼이 튀어 보인다 (별도 active 정의가 없는 버튼 전반의 기본값) */
button:active  { transform: scale(.985); }


/* --- 카드 --- */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-title { font-size: 1rem; font-weight: 600; }
.card-sub   { font-size: .8rem; color: var(--text-sub); margin-bottom: 10px; }
.card-actions { display: flex; gap: 8px; }

/* --- 배지 --- */
.badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
}
.badge-active    { background: #d1fae5; color: #065f46; }
.badge-suspended { background: #fef3c7; color: #92400e; }
.badge-deleted   { background: #fee2e2; color: #991b1b; }
/* 진행 중(파랑) — 완료(녹색 badge-active)와 구분. 발주중 등 "아직 끝나지 않은" 상태 */
.badge-info      { background: #dbeafe; color: #1e40af; }

/* --- 알림 메시지 --- */
.alert {
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: .9rem;
    margin-top: 12px;
}
.alert-error   { background: #fee2e2; color: #991b1b; }
.alert-success { background: #d1fae5; color: #065f46; }
/* 경고 — badge-warn 과 같은 톤. --warn 은 다크테마에서 재정의된다 */
.alert-warn    { background: rgba(255,159,10,.15); color: var(--warn); }

/* --- 보조 안내문 (빈 상태 문구 등) --- */
.hint { font-size: .82rem; color: var(--text-sub); }

/* --- 도움말: 타이틀에 data-hint 를 붙이면 클릭 시 토스트로 보여준다 (main.js showHintToast) --- */
[data-hint] { cursor: pointer; }

/* --- 폼 --- */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: var(--text-sub); margin-bottom: 5px; }

/* --- 섹션 카드 --- */
.section-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
/* 제목이 워크스페이스 헤더로 빠져 액션 버튼만 남은 헤더 —
   space-between 이라 혼자 남으면 왼쪽으로 붙는다. 버튼은 계속 오른쪽에 둔다. */
.page-header > :only-child { margin-left: auto; }
.section-title {
    font-size: 1rem; font-weight: 700; margin-bottom: 12px;
    padding-left: 9px; border-left: 3px solid var(--primary);
}
.section-desc  { font-size: .85rem; color: var(--text-sub); margin-bottom: 12px; }

/* --- 워크스페이스 탭 스트립 (모듈 상단, 밑줄형) --- */
.ws { margin-bottom: 18px; }
/* 브레드크럼(작은 글씨) — PC 전용. 사이드바에 이미 3단 메뉴가 있어 본문의 큰 제목·탭은 군더더기다.
   모바일은 사이드바가 없어 제목·탭이 길잡이 역할을 하므로 그대로 둔다(아래 미디어쿼리에서 가른다). */
.ws-crumb { display: none; }
.ws-crumb-sep { margin: 0 5px; opacity: .5; }
.ws-crumb-cur { color: var(--text); font-weight: 600; }
.ws-title {
    font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em;
    color: var(--text); margin-bottom: 10px;
    padding-left: 12px; border-left: 3px solid var(--primary);
}
.ws-tabs {
    display: flex; gap: 2px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;                 /* 모바일: 탭 가로 스크롤 */
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.ws-tabs::-webkit-scrollbar { display: none; }
.ws-tab {
    flex: 0 0 auto;
    padding: 9px 14px;
    font-size: .9rem; font-weight: 500;
    color: var(--text-sub);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;              /* 컨테이너 보더 위에 탭 밑줄이 겹치게 */
    white-space: nowrap;
    transition: color .15s, border-color .15s;
}
.ws-tab:hover { color: var(--text); }
.ws-tab--on {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 700;
}

/* --- 탭바 (화면 내부 서브탭 — 유지) --- */
.tab-bar {
    display: flex;
    gap: 0;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}
.tab-btn {
    flex: 1;
    border: none;
    background: none;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-sub);
    cursor: pointer;
    transition: background .2s, color .2s;
}
.tab-btn.tab-active {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
}
.tab-content { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

/* --- 인포 카드 (출퇴근) --- */
.info-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.info-date { font-size: .9rem; color: var(--text-sub); margin-bottom: 2px; }
.info-time { font-size: 2.4rem; font-weight: 700; letter-spacing: -1px; margin-bottom: 14px; }
.info-row  { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--border); }
.info-label { font-size: .85rem; color: var(--text-sub); }
.info-value { font-size: .9rem; font-weight: 600; }

/* --- GPS 상태 --- */
.gps-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    border: 1px solid var(--border);
    font-size: .85rem;
    color: var(--text-sub);
}
.gps-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--border);
    display: inline-block;
    transition: background .3s;
}
.gps-dot.active { background: var(--success); box-shadow: 0 0 6px var(--success); }
.btn-gps-reconnect {
    margin-left: auto;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    font-size: .76rem;
    color: var(--text-sub);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.btn-gps-reconnect:hover { background: var(--bg); color: var(--text); }

/* --- 액션 카드 (큼직한 카드형 버튼) --- */
.action-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}
.action-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    text-align: center;
    color: var(--text);
}
.action-card:active { transform: scale(.96); box-shadow: none; }
.action-icon  { font-size: 2rem; color: var(--primary); display: inline-flex; }
.action-icon svg { width: 1.5rem; height: 1.5rem; display: block; }
.action-label { font-size: .9rem; font-weight: 600; }
/* 아이콘 슬롯 SVG 공통 (라인 아이콘) */
.action-icon svg, .stat-icon svg, .gate-icon svg,
.member-card-avatar--default svg, .avatar-default-icon svg,
.vc-gallery-placeholder svg, .vc-card-thumb--empty svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.action-card--checkin  { border-color: var(--success); }
.action-card--report   { border-color: var(--primary); }
.action-card--map      { border-color: var(--warn); }
.action-card--checkout { border-color: var(--danger, #ff3b30); }

/* ===================================================
   대시보드 메뉴 (CEO·지부장·점장 홈) — 아이콘 왼쪽 + 라벨.
   모바일 = 리스트 행(아래 미디어쿼리), 태블릿/PC = 가로형 그리드 카드.
   base .action-card(세로형)는 출퇴근·보고 카드용이라 건드리지 않는다.
   =================================================== */
.menu-cat {
    font-size: .78rem; font-weight: 700; color: var(--text-sub);
    letter-spacing: .02em; margin: 22px 2px 8px;
}
.menu-cat:first-of-type { margin-top: 8px; }

.mobile-menu-grid .action-card {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    gap: 13px;
    padding: 15px 16px;
}
.mobile-menu-grid .action-label { flex: 1; font-weight: 600; }
.mobile-menu-grid .action-icon {
    width: 40px; height: 40px; border-radius: 11px; flex: none;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
}
.mobile-menu-grid .action-icon svg { width: 21px; height: 21px; }

/* PC(≥640): 메뉴는 4열(컬러 아이콘 카드). 일반 .action-grid(3열)보다 우선. */
@media (min-width: 640px) {
    .action-grid.mobile-menu-grid { grid-template-columns: repeat(4, 1fr); }
}

/* 카테고리/기능별 아이콘 색 — 아래 순서상 .mobile-menu-grid .action-icon 뒤라 색이 우선 적용됨.
   틴트 칩 배경 + 같은 색 아이콘. red/blue 는 테마 토큰, 나머지는 다크 대비 위해 아래 보정. */
.action-icon.i-blue   { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.action-icon.i-green  { background: color-mix(in srgb, #1da03e 16%, transparent); color: #1da03e; }
.action-icon.i-amber  { background: color-mix(in srgb, #d97706 18%, transparent); color: #d97706; }
.action-icon.i-red    { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.action-icon.i-purple { background: color-mix(in srgb, #7c3aed 16%, transparent); color: #7c3aed; }
.action-icon.i-teal   { background: color-mix(in srgb, #0d9488 18%, transparent); color: #0d9488; }
.action-icon.i-slate  { background: color-mix(in srgb, var(--text-sub) 16%, transparent); color: var(--text-sub); }
.theme-dark .action-icon.i-green  { color: #34d399; }
.theme-dark .action-icon.i-amber  { color: #fbbf24; }
.theme-dark .action-icon.i-purple { color: #a78bfa; }
.theme-dark .action-icon.i-teal   { color: #2dd4bf; }

/* ===================================================
   대시보드 상단 KPI 스트립 — 오늘 매출(히어로) + 출근·미마감·재고부족·발주대기.
   PC: 한 줄(히어로 2 + 4). 모바일: 오늘 매출만(나머지 숨김).
   =================================================== */
.kpi-strip { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; margin: 4px 0 8px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; box-shadow: var(--shadow); }
.kpi-lab { font-size: .76rem; color: var(--text-sub); display: flex; align-items: center; gap: 7px; }
.kpi-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.kpi-val { font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; margin-top: 7px;
    font-variant-numeric: tabular-nums; }
/* KPI 숫자 밑 작은 목록 (예: 재고 부족 → 부족 품목 몇 개) */
.kpi-sub { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.kpi-sub-item { font-size: .72rem; color: var(--text-sub); overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }
.kpi-sub-more { font-size: .7rem; color: var(--text-sub); opacity: .8; }
.kpi-hero { background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 9%, var(--surface)), var(--surface)); }
.kpi-hero .kpi-val { font-size: 1.7rem; }
/* 오늘 매출 히어로 — 어제 대비 증감률 + 최근 7일 스파크라인 */
.kpi-delta { font-size: .74rem; font-weight: 600; margin-top: 3px; }
.kpi-delta.up   { color: #1da03e; }
.kpi-delta.down { color: var(--danger); }
.theme-dark .kpi-delta.up { color: #34d399; }
.kpi-spark { display: flex; align-items: flex-end; gap: 3px; height: 28px; margin-top: 8px; }
.kpi-spark > i { flex: 1; background: var(--primary); opacity: .7; border-radius: 2px 2px 0 0; min-height: 2px; }
.kpi-val.v-amber { color: #d97706; }
.kpi-val.v-red   { color: var(--danger); }
.kpi-val.v-blue  { color: var(--primary); }
.theme-dark .kpi-val.v-amber { color: #fbbf24; }
@media (max-width: 639.98px) {
    .kpi-strip { grid-template-columns: 1fr; }
    .kpi-min { display: none; }   /* 모바일은 오늘 매출만 (메뉴가 빨리 오도록) */
}

/* --- 하단 고정 버튼 영역 --- */
.bottom-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-bottom: env(safe-area-inset-bottom, 16px);
}
.bottom-actions .btn-primary,
.bottom-actions .btn-secondary,
.bottom-actions .btn-warn { flex: 1; }

/* --- 모달 --- */
@keyframes modal-fade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop   { from { opacity: 0; transform: translateY(12px) scale(.97); }
                         to   { opacity: 1; transform: translateY(0) scale(1); } }
.modal-overlay {
    position: fixed; inset: 0;
    /* backdrop-filter(블러) 를 쓰지 않는다 — 화면 전체를 매 프레임 다시 합성해야 해서
       특히 PC 큰 화면·긴 목록 뒤에서 모달을 열 때 눈에 띄게 버벅였다.
       가리는 역할은 불투명도를 조금 올린 딤으로 대신한다. */
    background: rgba(15,18,28,.58);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    overscroll-behavior: contain;   /* 모달 안 스크롤이 뒤 페이지로 이어지지 않게 */

    /* 오버레이 자체는 애니메이션하지 않는다.
       뷰포트 전체 크기 요소의 opacity 를 애니메이션하면 매 프레임 화면 전체를 새 레이어로
       합성해야 해서, PC 큰 화면에서 모달 여는 순간 눈에 띄게 버벅였다.
       등장 연출은 .modal-box 의 modal-pop 만으로 충분하다.
       (exit 페이드는 예전에 안드로이드 WebView 리페인트 지연 버그로 이미 제거됨) */
}
/* 모달 열림 중 배경 스크롤 잠금 (main.js 가 토글) — 오버레이 아래 리페인트 차단 */
body.modal-open { overflow: hidden; }

.modal-box {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
    animation: modal-pop .22s cubic-bezier(.22,1,.36,1);
}
.modal-box h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions button { flex: 1; }

/* --- 모달 필드 (수정 모달 등) --- */
.modal-field { margin-bottom: 14px; }
.modal-label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-sub);
    margin-bottom: 6px;
}
.modal-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: .9rem;
    resize: none;
}
.modal-input:focus { outline: none; border-color: var(--primary); }
/* 모달 셀렉트 — 전역 select(높이 30px 고정)에 .modal-input 의 상하 9px 패딩이 겹치면 글자가 잘린다.
   오른쪽은 커스텀 화살표 자리(28px)를 남긴다 */
select.modal-input { height: 38px; padding: 0 28px 0 12px; }

/* --- 품목사진 --- */
/* 돋보기 — 품목명 옆 작은 버튼, 클릭 시 이미지 확대 모달(showImageModal). 사진 있는 품목에만 붙는다 */
.img-zoom-btn { display:inline-flex; align-items:center; justify-content:center;
    width:20px; height:20px; margin-left:4px; padding:0; border:none; background:none;
    color:var(--text-sub); cursor:zoom-in; vertical-align:-4px; }
.img-zoom-btn svg { width:14px; height:14px; }
.img-zoom-btn:hover { color:var(--primary); }
/* 품목 마스터 '사진' 열의 썸네일 — 없는 품목은 디폴트 자리표시(열 정렬 유지) */
.it-thumb { width:32px; height:32px; object-fit:cover; border-radius:6px;
    border:1px solid var(--border); vertical-align:middle; cursor:zoom-in; }
.it-thumb--empty { display:inline-flex; align-items:center; justify-content:center;
    background:var(--bg); color:var(--text-sub); cursor:default; }
.it-thumb--empty svg { width:15px; height:15px; }

/* --- 아이템 리스트 --- */
.item-list { display: flex; flex-direction: column; gap: 10px; }
.item-row {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.item-row-name  { font-weight: 600; font-size: .95rem; }
.item-row-sub   { font-size: .8rem; color: var(--text-sub); margin-top: 2px; }

/* 표처럼 읽히는 리스트 — 낱장 카드가 10px 씩 떠 있으면 훑기 어렵다.
   .item-list 에 함께 주면 한 덩어리(테두리 하나 + 연한 행 구분선)로 보인다. */
.item-list--rows {
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
}
.item-list--rows > .item-row {
    background: none; border: none; border-radius: 0;
    border-bottom: 1px solid var(--row-line);
    padding: 9px 14px;
}
.item-list--rows > .item-row:last-child { border-bottom: none; }
.item-list--rows > .item-row:hover { background: var(--bg); }
.item-list--rows > .empty-state { padding: 22px 0; font-size: .88rem; }

/* 행 한 줄 구성(이름·배지·아이디 등을 가로로) — 승인/발급 류 목록 공용 */
.item-row-main {
    flex: 1 1 auto; min-width: 0;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
/* 행 왼쪽 이니셜 아바타 — 사진 없는 목록에 얼굴 역할 */
.row-avatar {
    flex: 0 0 28px; width: 28px; height: 28px; margin-right: 10px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 700;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
}

/* --- 정산 상태 색상 --- */
.status-paid   { color: var(--success); font-weight: 700; }
.status-unpaid { color: var(--danger);  font-weight: 700; }

/* --- 차트 카드 --- */
.chart-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.chart-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: 12px; }

/* --- 코드 결과 카드 — 라벨·코드·복사를 한 줄로 --- */
.code-result-card {
    background: color-mix(in srgb, var(--primary) 5%, var(--surface));
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-top: 14px;
    border: 1.5px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.code-label { font-size: .8rem; color: var(--text-sub); flex: none; }
.code-value { font-size: 1.25rem; font-weight: 700; letter-spacing: 2px; flex: 1 1 auto;
    font-family: 'Courier New', monospace; }

/* --- 스와이프 슬라이더 --- */
.swipe-hint { font-size: .8rem; color: var(--text-sub); text-align: center; margin-bottom: 8px; }
.slider-container {
    overflow-x: auto;
    display: flex;
    gap: 12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
}
.slider-item {
    flex: 0 0 100%;
    scroll-snap-align: start;
}
.slider-dots { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
.slider-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.slider-dot.active { background: var(--primary); }

/* --- 비품 현황 고정 헤더 --- */
.sticky-header {
    position: sticky;
    top: var(--nav-h);
    background: var(--surface);
    z-index: 10;
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
}

/* --- 빈 상태 --- */
.empty-state { text-align: center; color: var(--text-sub); padding: 40px 0; font-size: .95rem; }

/* --- CEO 출퇴근 바 --- */
.ceo-attendance-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}
.btn-checkin-sm  { background: var(--success); color: #fff; border: none; border-radius: var(--radius-sm); padding: 8px 16px; font-weight: 700; cursor: pointer; }
.btn-checkout-sm { background: var(--danger);  color: #fff; border: none; border-radius: var(--radius-sm); padding: 8px 16px; font-weight: 700; cursor: pointer; }
.attend-status   { flex: 1; text-align: center; font-size: .9rem; color: var(--text-sub); }

/* --- 날짜 피커 --- */
.date-picker {
    width: auto;
    padding: 6px 10px;
    font-size: .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
}

/* --- 반응형: 태블릿/PC --- */
@media (min-width: 640px) {
    .page-container { padding: 24px 40px; }
    .card-grid { grid-template-columns: 1fr 1fr; }
    .action-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1440px) {
    .page-container { padding: 28px 56px; }
}

/* ===================================================
   모바일 대시보드 메뉴 — 리스트 행 (옵션3)
   각 카테고리(.action-grid)가 하나의 둥근 리스트 카드가 되고, 그 안에서
   메뉴가 행으로 쌓인다(아이콘 + 라벨 + 오른쪽 화살표). 엄지로 누르기 쉬운 형태.
   =================================================== */
@media (max-width: 639.98px) {
    .action-grid.mobile-menu-grid {
        grid-template-columns: 1fr;
        gap: 0;
        margin-top: 12px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        overflow: hidden;
    }
    .mobile-menu-grid .action-card {
        background: transparent;
        border: none;
        border-bottom: 1px solid var(--row-line);
        border-radius: 0;
        box-shadow: none;
        padding: 14px 15px;
    }
    .mobile-menu-grid .action-card:last-child { border-bottom: none; }
    .mobile-menu-grid .action-card:active { transform: none; background: rgba(0,0,0,.05); }
    .theme-dark .mobile-menu-grid .action-card:active { background: rgba(255,255,255,.06); }
    /* 오른쪽 화살표(클릭 가능 표시) — 마크업 수정 없이 CSS 로 */
    .mobile-menu-grid .action-card::after {
        content: '›';
        color: var(--text-sub);
        opacity: .55;
        font-size: 1.5rem;
        line-height: 1;
        margin-left: 4px;
    }
    .mobile-menu-grid .action-icon { width: 38px; height: 38px; border-radius: 10px; }
    .mobile-menu-grid .action-icon svg { width: 20px; height: 20px; }
    .mobile-menu-grid .action-label { font-size: .92rem; }
}

/* ── 슈퍼어드민 stat 카드 ── */
.stat-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
@media (min-width: 640px) {
    .stat-row { grid-template-columns: repeat(4, 1fr); }
}
.stat-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: border-color .15s;
}
.stat-card:hover { border-color: var(--text-sub); }
/* 색조는 그대로 두되 그라데이션은 걷어냄 — 같은 색의 단색 틴트 */
.stat-card--blue   { background: #eaf4fd; }
.stat-card--green  { background: #e9f9f0; }
.stat-card--teal   { background: #e5f5f2; }
.stat-card--orange { background: #fff5e6; }
.theme-dark .stat-card--blue   { background: #0c2a45; border-color: rgba(10,132,255,.2); }
.theme-dark .stat-card--green  { background: #0c3220; border-color: rgba(52,199,89,.2); }
.theme-dark .stat-card--teal   { background: #0c2e2a; border-color: rgba(100,210,200,.2); }
.theme-dark .stat-card--orange { background: #322200; border-color: rgba(255,159,10,.2); }
.stat-icon  { font-size: 1.8rem; line-height: 1; display: inline-flex; align-items: center; }
.stat-icon svg { width: 1.7rem; height: 1.7rem; display: block; }
.stat-label { font-size: .75rem; color: var(--text-sub); font-weight: 500; margin-bottom: 2px; }
.stat-value { font-size: 1.3rem; font-weight: 800; color: var(--text); letter-spacing: -.5px; }

/* ── 정보 그리드 ── */
.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 8px;
}
@media (min-width: 640px) {
    .info-grid { grid-template-columns: 1fr 1fr; }
}
.kv-list  { display: flex; flex-direction: column; gap: 0; }
.kv-row   { display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .85rem; }
.kv-row:last-child { border-bottom: none; }
.kv-key   { color: var(--text-sub); font-weight: 500; }
.kv-val   { font-weight: 600; color: var(--text); }

/* ===================================================
   PC 레이아웃 — 상단 대메뉴 + 좌측 하위메뉴
   대메뉴(사이드바의 카테고리)를 상단바로 올리고, 고른 대메뉴의 하위 링크만 사이드바에 남긴다.
   =================================================== */
:root { --sidebar-w: 188px; --pc-topbar-h: 0px; --pc-sb-toggle-w: 40px; }
/* 사이드바 접기 — 폭 변수만 0으로 바꾸면 본문 padding·브랜드 폭이 전부 따라온다 */
body.sb-collapsed { --sidebar-w: 0px; }

.sidebar, .pc-topbar {
    /* 내비 전용 팔레트(라이트/다크 테마와 무관하게 항상 다크 그린) */
    --sb-bg-top: #11432f;
    --sb-bg-bot: #0b3324;
    --sb-card:   #0c3727;
    --sb-text:   #eaf3ee;
    --sb-muted:  #9fc2b1;
    --sb-active: #16b364;
    --sb-line:   rgba(255,255,255,.08);
}
.sidebar, .pc-topbar { display: none; }

@media (min-width: 1024px) {
    :root { --pc-topbar-h: 46px; }
    body.has-sidebar { padding-left: var(--sidebar-w); padding-top: var(--pc-topbar-h); }
    /* 데스크톱: 사이드바가 있는 화면만 — 상단 대메뉴·사이드바가 로고·사용자·로그아웃·테마를 모두 제공하므로 상단바는 감춘다.
       (지도 화면만 예외 — 자체 컨트롤을 상단바에 둠) 콘텐츠-우선, 화면 간 일관.
       ※ has-sidebar 로 스코프 필수 — 슈퍼어드민 콘솔처럼 사이드바 없는 화면은 상단바가 유일한 내비게이션. */
    body.has-sidebar .top-nav:not(.top-nav--map) { display: none !important; }
    /* PC 는 상단바를 고정하지 않는다 — 사이드바가 늘 있고, 고정하면 세로 공간만 먹는다 */
    .top-nav { position: static; }
    /* 고정 상단 대메뉴가 생겼으므로 화면 안 sticky 요소는 그 아래에 붙는다 */
    .sticky-header { top: var(--pc-topbar-h); }

    /* PC: 사이드바가 대메뉴→메뉴→탭 3단을 다 보여주므로 본문 큰 제목·탭은 감추고
       작은 브레드크럼("창고 반출 › 반출 이력")만 남긴다. */
    .ws-title, .ws-tabs { display: none; }
    .ws { margin-bottom: 12px; }
    .ws-crumb {
        display: block;
        font-size: .78rem;
        color: var(--text-sub);
        letter-spacing: -.01em;
    }

    /* ── 상단 대메뉴 ── */
    .pc-topbar {
        display: flex;
        align-items: stretch;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: var(--pc-topbar-h);
        background: linear-gradient(90deg, var(--sb-bg-top), var(--sb-bg-bot));
        /* 모달(200)보다 아래 — 대메뉴가 모달 위로 뜨면 안 된다 */
        z-index: 150;
    }

    .sidebar {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: var(--pc-topbar-h); left: 0; bottom: 0;
        width: var(--sidebar-w);
        background: linear-gradient(180deg, var(--sb-bg-top), var(--sb-bg-bot));
        border-right: none;
        z-index: 200;
        overflow-y: auto;
    }
    body.sb-collapsed .sidebar { display: none; }
}

/* ── 상단 대메뉴 내부 ── */
/* 브랜드 + 접기버튼이 사이드바 폭을 정확히 채운다 → 대메뉴가 사이드바 열을 침범하지 않는다.
   (접으면 사이드바 폭이 0 이 되므로 브랜드는 제 크기로 돌아간다) */
.pc-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    width: calc(var(--sidebar-w) - var(--pc-sb-toggle-w));
    box-sizing: border-box;
    padding: 0 10px 0 16px;
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: -.4px;
    white-space: nowrap;
    overflow: hidden;
    color: #ffffff;
    text-decoration: none;
    flex-shrink: 0;
}
body.sb-collapsed .pc-brand { width: auto; padding-right: 14px; }
.pc-brand-img { width: 24px; height: 24px; object-fit: contain; border-radius: 6px; flex-shrink: 0; }
/* 사이드바 접기/펴기 — 사이드바 열의 오른쪽 끝에 붙어 경계 역할도 한다 */
.pc-sb-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--pc-sb-toggle-w);
    border: none;
    background: none;
    color: var(--sb-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: color .15s, background .15s;
}
.pc-sb-toggle:hover { background: rgba(255,255,255,.10); color: #ffffff; }
.pc-sb-toggle svg { width: 18px; height: 18px; display: block; }
/* min-width:0 이라야 오른쪽 공지 영역에 자리를 내주고 스스로 가로 스크롤된다 */
.pc-menu { display: flex; align-items: stretch; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.pc-menu::-webkit-scrollbar { height: 0; display: none; }
/* ── 우측 상단: 테마 · 공지(종+배지) · 프로필 메뉴 ── */
.pc-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; padding: 0 12px 0 8px; flex-shrink: 0; }
.pc-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border: none;
    border-radius: 9px;
    background: none;
    color: var(--sb-muted);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.pc-icon-btn:hover { background: rgba(255,255,255,.10); color: #ffffff; }
.pc-icon-btn svg { width: 19px; height: 19px; display: block; }
/* 미확인 공지 수 — 종 오른쪽 위 작은 동그라미 */
.pc-notice .nav-badge {
    position: absolute;
    top: 1px; right: 1px;
    margin-left: 0;
    min-width: 15px; height: 15px;
    padding: 0 4px;
    font-size: .62rem;
    border: 2px solid var(--sb-bg-top);
    box-sizing: content-box;
}

.pc-profile { position: relative; margin-left: 4px; }
.pc-profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border: none;
    border-radius: 999px;
    background: none;
    color: var(--sb-text);
    cursor: pointer;
    transition: background .15s;
}
.pc-profile-btn:hover { background: rgba(255,255,255,.10); }
.pc-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,.14);
    display: inline-flex; align-items: center; justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.pc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pc-avatar svg  { width: 22px; height: 22px; color: var(--sb-text); }
.pc-profile-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.pc-profile-name { font-size: .8rem; font-weight: 700; color: #ffffff; white-space: nowrap; }
.pc-profile-role { font-size: .68rem; color: var(--sb-muted); white-space: nowrap; }

.pc-profile-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px); right: 0;
    min-width: 160px;
    padding: 6px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 10px 28px rgba(0,0,0,.18);
    /* 모달(200)보다는 아래, 본문 sticky(100)보다는 위 */
    z-index: 160;
}
.pc-profile-menu.open { display: block; }
.pc-profile-menu form { margin: 0; }
.pc-profile-item {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--text);
    font-size: .84rem;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.pc-profile-item:hover { background: var(--bg); }
.pc-profile-item--danger { color: var(--danger); }
.pc-menu-btn {
    padding: 0 15px;
    margin: 6px 0;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--sb-muted);
    font-size: .875rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.pc-menu-btn:hover { background: rgba(255,255,255,.08); color: #ffffff; }
/* 고른 대메뉴 = 테두리로 감싼 칩 (지금 어느 묶음을 보고 있는지 한눈에) */
.pc-menu-btn.on {
    color: #ffffff;
    background: rgba(255,255,255,.10);
    box-shadow: inset 0 0 0 1.5px var(--sb-active);
}

/* 사이드바 내부 — 다크 그린 (목업 기준) */
/* 고른 대메뉴 이름 — 사이드바가 무엇의 하위인지 알려준다 */
.sidebar-sect {
    padding: 16px 18px 10px;
    font-size: .95rem;
    font-weight: 700;
    color: #ffffff;
    border-bottom: 1px solid var(--sb-line);
    flex-shrink: 0;
}
.sidebar-nav {
    flex: 1;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    border-radius: 12px;
    color: var(--sb-muted);
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.sidebar-link:hover { background: rgba(255,255,255,.06); color: var(--sb-text); }
/* 활성 = 은은한 채움 + 좌측 강조 바 (글로우 없음) */
.sidebar-link.active {
    background: rgba(22,179,100,.16);
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--sb-active);
}
.sidebar-divider { height: 1px; background: var(--sb-line); margin: 10px 14px; }

/* 아이콘은 상단 대메뉴 + 하위메뉴 구조에선 소음이라 감춘다(스프라이트는 프로필 아바타 등이 계속 쓴다) */
.sidebar-link-icon { display: none; }

/* ── 3단째: 사이드바 하위 탭 (아코디언) ──
   메뉴마다 자기 하위 탭을 갖고, 화살표로 각자 펼치고 접는다(여러 개 동시에 열 수 있음). */
.sidebar-sub { display: none; }
.sidebar-sub.open { display: flex; }
.sidebar-sub {
    flex-direction: column;
    gap: 1px;
    /* 들여쓰기 + 세로 안내선으로 '이 메뉴의 하위'임을 보인다 */
    margin: 2px 0 6px 22px;
    padding-left: 10px;
    border-left: 1px solid var(--sb-line);
}
.sidebar-sub-link {
    padding: 6px 10px;
    border-radius: 8px;
    font-size: .77rem;
    font-weight: 600;
    color: var(--sb-muted);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background .15s, color .15s;
}
.sidebar-sub-link:hover { background: rgba(255,255,255,.06); color: #ffffff; }
.sidebar-sub-link.on { color: #ffffff; background: rgba(22,179,100,.16); }

/* 접기/펴기 화살표 — 링크 안 오른쪽 끝. 클릭은 이동과 분리된다(스크립트가 stopPropagation) */
.sidebar-caret {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: none;
    color: inherit;
    opacity: .55;
    cursor: pointer;
    transform: rotate(-90deg);
    transition: transform .18s ease, opacity .15s, background .15s;
}
.sidebar-caret:hover { opacity: 1; background: rgba(255,255,255,.1); }
.sidebar-caret.open { transform: rotate(0deg); }
.sidebar-caret svg { display: block; }
/* 카테고리 헤더는 상단 대메뉴로 올라갔다 — 사이드바에선 안 보인다 */
.sidebar-cat { display: none; }
/* 고르지 않은 대메뉴의 하위 링크 숨김 */
.cat-hidden { display: none !important; }

/* ★깜빡임 차단 — 어느 대메뉴를 열지 정해지기 전엔 아무것도 그리지 않는다.
   서버는 모든 메뉴를 펼친 채 내려주므로, 스크립트가 접기 전에 한 번 그려지면
   '전체 목록이 번쩍였다가 접히는' 깜빡임이 난다. 스크립트가 `menu-ready` 를 달면 그때 보인다. */
.sidebar-nav:not(.menu-ready) .sidebar-link,
.sidebar-nav:not(.menu-ready) .sidebar-sub { visibility: hidden; }

/* ── 스크롤바 숨김 (휠·드래그·터치로 스크롤) ── */
.sidebar-nav { scrollbar-width: none; -ms-overflow-style: none; }
.sidebar-nav::-webkit-scrollbar { width: 0; height: 0; display: none; }
.sidebar { scrollbar-width: none; }
.sidebar::-webkit-scrollbar { width: 0; display: none; }
.sidebar-nav.sb-dragging { cursor: grabbing; }
.sidebar-nav.sb-dragging .sidebar-link { cursor: grabbing; }

/* ===================================================
   토스트 (Android/PC 공통)
   =================================================== */
.nfp-toast-container {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    width: 90%;
    max-width: 360px;
}
.nfp-toast {
    background: rgba(29,29,31,.93);
    color: #f5f5f7;
    padding: 11px 22px;
    border-radius: 24px;
    font-size: .88rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,.28);
    animation: nfpToastIn .22s ease both;
    pointer-events: auto;
    text-align: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    max-width: 100%;
    word-break: keep-all;
}
.nfp-toast--success {
    background: rgba(52,199,89,.15);
    color: #30d158;
    border: 1px solid rgba(52,199,89,.3);
}
.nfp-toast--error {
    background: rgba(255,69,58,.15);
    color: #ff453a;
    border: 1px solid rgba(255,69,58,.3);
}
.nfp-toast--info {
    background: rgba(10,132,255,.15);
    color: #0a84ff;
    border: 1px solid rgba(10,132,255,.3);
}
@keyframes nfpToastIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===================================================
   커스텀 Confirm / Prompt 다이얼로그
   =================================================== */
.nfp-dialog-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: nfpFadeIn .18s ease;
}
@keyframes nfpFadeIn { from { opacity: 0; } to { opacity: 1; } }
.nfp-dialog-box {
    background: var(--surface);
    border-radius: 20px;
    padding: 28px 24px 20px;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 12px 48px rgba(0,0,0,.35);
}
.nfp-dialog-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    text-align: center;
}
.nfp-dialog-msg {
    font-size: .9rem;
    color: var(--text-sub);
    line-height: 1.55;
    margin-bottom: 20px;
    white-space: pre-line;
    text-align: center;
}
.nfp-dialog-input {
    width: 100%;
    margin-bottom: 16px;
    font-size: .95rem;
}
.nfp-dialog-actions {
    display: flex;
    gap: 10px;
}
.nfp-dialog-actions button { flex: 1; }

/* ─────────────────────────────────────────
 * 배지 (role / status 표시)
 * ───────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .2px;
}
.badge-primary { background: rgba(0,113,227,.12); color: var(--primary); }
.badge-success { background: rgba(52,199,89,.15); color: var(--success); }
.badge-warn    { background: rgba(255,159,10,.15); color: var(--warn); }
.badge-info    { background: rgba(90,200,250,.15); color: #1398c7; }
.theme-dark .badge-info { color: #5ac8fa; }

/* ─────────────────────────────────────────
 * 필터 바
 * ───────────────────────────────────────── */
.filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    color: var(--text-sub);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.filter-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(0,113,227,.08);
}

/* ─────────────────────────────────────────
 * 탭 배지 (숫자 알림)
 * ───────────────────────────────────────── */
.tab-badge {
    display: inline-block;
    background: var(--danger);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 6px;
    vertical-align: middle;
    line-height: 1.4;
    margin-left: 2px;
}


/* ═══════════════════════════════════════════
 * 모바일 상단 네비 회원명 (전역)
 * ═══════════════════════════════════════════ */
.mobile-nav-member-name {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    padding: 0 6px;
    white-space: nowrap;
    overflow: hidden;
    max-width: 80px;
    text-overflow: ellipsis;
}
@media (min-width: 1024px) {
    .mobile-nav-member-name { display: none; }
}

/* ═══════════════════════════════════════════
 * 회원 정보 빠른 모달 (전역 — sidebar fragment)
 * ═══════════════════════════════════════════ */
.mim-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0 0;
    gap: 4px;
}
.mim-avatar-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.mim-avatar-img {
    width: 112px;
    height: 112px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
}
.mim-avatar-default {
    font-size: 5rem;
    line-height: 1;
}
.mim-name {
    font-size: 1.3rem;
    font-weight: 800;
    text-align: center;
    color: var(--text);
    margin-top: 6px;
}
.mim-logincode {
    font-size: .78rem;
    text-align: center;
    color: var(--text-sub);
    font-family: 'Courier New', monospace;
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 2px;
}
.mim-role {
    font-size: .88rem;
    text-align: center;
    color: var(--text-sub);
    margin-top: 4px;
}
.mim-phone {
    font-size: 1.05rem;
    text-align: center;
    color: var(--primary);
    font-weight: 600;
    margin: 8px 0 16px;
}

/* ── 비품 일별 요약 (Task 15) ── */
.supply-total-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--surface);
    border-radius: 12px; font-weight: 700; font-size: .9rem;
    border: 1px solid var(--border); margin-bottom: 12px;
}
.supply-slide-row {
    display: flex; gap: 12px; overflow-x: auto;
    padding-bottom: 8px; -webkit-overflow-scrolling: touch;
}
.supply-truck-card {
    flex: 0 0 88%; max-width: 360px;
    border: 1px solid var(--border); border-radius: 12px;
    padding: 14px; background: var(--surface);
}
.supply-truck-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.supply-truck-num { font-weight: 700; font-size: .95rem; }
.supply-truck-total { font-size: .82rem; color: var(--primary); font-weight: 600; }
.supply-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
/* 품목명만 접히게 두고 머리글·숫자는 붙여 쓴다 — 폰 폭에서는 '수량' 이 '수/량' 으로 쪼개진다 */
.supply-table th { color: var(--text-sub); font-weight: 500; padding: 6px 4px; font-size: .78rem; white-space: nowrap; }
.supply-table td { padding: 7px 4px; border-top: 1px solid var(--border); }
.supply-table td:not(:first-child) { white-space: nowrap; }
@media (min-width: 1024px) {
    .supply-truck-card { flex: 0 0 320px; }
}

/* ===================================================
   사이드바 메뉴 배지 (공지 미확인 수)
   =================================================== */
.nav-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* 공지 목록 미확인 점 */
.notice-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    display: inline-block;
}

/* ===================================================
   공지 인앱 배너 (상단, 확인 시까지 유지)
   =================================================== */
.nfp-notice-stack {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 92%;
    max-width: 460px;
    pointer-events: none;
}
.nfp-notice-item {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    box-shadow: 0 6px 24px rgba(0,0,0,.18);
    padding: 12px 12px 12px 14px;
    transition: opacity .22s, transform .22s;
    animation: nfpToastIn .22s ease both;
}
.nfp-notice-item-icon { color: var(--primary); flex-shrink: 0; margin-top: 1px; }
.nfp-notice-item-body { flex: 1; min-width: 0; cursor: pointer; }
.nfp-notice-item-title {
    font-size: .9rem; font-weight: 700; color: var(--text);
    margin-bottom: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nfp-notice-item-text {
    font-size: .82rem; color: var(--text-sub); line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.nfp-notice-item-close {
    flex-shrink: 0;
    background: none; border: none;
    color: var(--text-sub);
    font-size: 1.3rem; line-height: 1;
    cursor: pointer; padding: 0 2px;
}
.nfp-notice-item-close:hover { color: var(--text); }

/* ===================================================
   모션 / 전환 (점진적 향상 — 미지원 브라우저는 전부 무시)
   =================================================== */

/* 페이지 전환(@view-transition)은 제거됨 — 안드로이드 WebView 에서 전환이 끝나지 않아
   옛 페이지 스냅샷이 화면에 고정되고 입력이 전부 먹히는 현상 발생. 재도입 시 실기기 검증 필수. */

/* ── 터치 피드백 ──
   button:active / .action-card:active 의 scale 은 이미 있음. 여기선 탭 지연만 제거. */
button, a, [role="button"], .action-card { touch-action: manipulation; }

/* ── 키보드 포커스 링 ──
   input 류는 이미 box-shadow 포커스 링이 있으므로 제외(이중 링 방지). */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible,
.action-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ── 모션 최소화 선호 ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ── 모바일: 중앙 다이얼로그 → 바텀시트 ──
   PC(≥1024px)는 기존 중앙 모달 유지. .nfp-dialog-* (confirm/prompt) 는 대상 아님. */
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

@media (max-width: 1023.98px) {
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .modal-box {
        /* 인라인 style="max-width:340px" 등 6곳을 덮어야 해서 !important 사용 */
        width: 100% !important;
        max-width: none !important;
        max-height: 88vh;
        overflow-y: auto;
        overscroll-behavior: contain;
        position: relative;
        border-radius: 20px 20px 0 0;
        padding-top: 28px;
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
        animation: sheet-up .26s cubic-bezier(.22,1,.36,1);
    }
    /* 그래버 핸들 */
    .modal-box::before {
        content: '';
        position: absolute;
        top: 10px; left: 50%;
        transform: translateX(-50%);
        width: 38px; height: 4px;
        border-radius: 999px;
        background: var(--border);
    }
}

/* ─────────────────────────────────────────────
   데이터 표 (웹 관리자 콘솔 공용) — .table-wrap > table.data-table
   라이트/다크 테마·모바일 대응. 각 페이지의 인라인 정의를 대체.
   ───────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    /* 엑셀형 밀도 — 13px + 좁은 셀. 모바일(639px↓)은 카드로 변환되므로 여긴 PC 전용 밀도다.
       tabular-nums: 숫자 폭을 고정해 금액 자릿수가 세로로 정렬된다(이게 없으면 표가 안 '읽힌다'). */
    font-size: .8125rem;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.data-table th,
.data-table td {
    padding: 4px 10px;
    border-bottom: 1px solid var(--row-line);
    vertical-align: middle;
    text-align: left;
}
.data-table thead th {
    background: var(--bg);
    font-weight: 600;
    font-size: .72rem;
    color: var(--text-sub);
    white-space: nowrap;
    padding-top: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.data-table tbody tr:last-child td { border-bottom: none; }
/* 줄무늬 — 행이 촘촘해지면 시선이 줄을 잃는다. 구획·소계·펼침 행은 자기 배경이 있으니 제외.
   :where() 로 특이도를 0으로 눌러, 아래 hover·구획 규칙이 그대로 이긴다. */
.data-table tbody tr:nth-child(even):where(:not(.tbl-group-head, .grp-row, .tbl-subtotal, .is-expanded)) td {
    background: color-mix(in srgb, var(--text) 3%, transparent);
}
.data-table tbody tr:hover td { background: var(--bg); }
/* 지출·차감 등 음수 금액 — 합계만 진하게, 차감액은 한 톤 눌러서 스캔을 돕는다 */
.data-table td.neg { color: var(--text-sub); }

/* ── 구획 행 · 소계 · 펼침 행 ──
   데이터 행과 같은 톤이면 그룹 머리가 그냥 한 줄로 읽힌다(재고 현황의 품목 그룹이 그랬다).
   그룹은 파란 띠 + 왼쪽 강조선, 소계는 회색 띠로 역할을 나눈다. hover 규칙보다 뒤에 둬야 안 눌린다. */
.data-table tr.tbl-group-head > td,
.data-table tr.grp-row > td {
    background: color-mix(in srgb, var(--primary) 8%, var(--bg));
    color: var(--text);
    font-weight: 700; font-size: .82rem; letter-spacing: .02em;
    border-bottom: 1px solid var(--border);
    box-shadow: inset 3px 0 0 var(--primary);
}
/* 그룹에 속한 데이터 행은 한 단 들여써서 소속을 보인다 */
.data-table tr.grp-item > td:first-child { padding-left: 26px; }
.data-table tr.tbl-subtotal > td {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
/* 펼친 행 = 아래 상세의 머리. 왼쪽 강조선으로 상세와 한 덩어리로 묶는다. */
.data-table tr.is-expanded > td {
    background: color-mix(in srgb, var(--primary) 6%, var(--bg));
    border-bottom-color: transparent;
}
.data-table tr.is-expanded > td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
/* 표 안 폼 컨트롤 통일 */
.data-table input,
.data-table select {
    /* 표 안 입력칸 — 행 높이를 키우지 않으면서 셀을 꽉 채우는 값. 더 줄이면 셀 안에서 떠 보인다. */
    padding: 3px 7px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: .82rem;
    max-width: 100%;
}
.data-table input[type=number] { width: 92px; text-align: right; }

@media (max-width: 639.98px) {
    .data-table th,
    .data-table td { padding: 9px 10px; font-size: .84rem; }

    /* 표 → 카드 (sales-view.css 의 표→카드 패턴과 동일) — 정산류 등 데이터 표 공통 모바일 대응 */
    .table-wrap { border: none; background: none; box-shadow: none; }
    .data-table, .data-table tbody { display: block; width: 100%; }
    .data-table thead { display: none; }
    .data-table tr {
        display: block;
        background: var(--surface); border: 1px solid var(--border);
        border-radius: var(--radius); box-shadow: var(--shadow);
        padding: 4px 14px 6px; margin-bottom: 8px;
    }
    .data-table tr:last-child { margin-bottom: 0; }
    /* 카드 안에서도 표처럼 — 간격은 좁히고 항목 사이는 연한 헤어라인으로 나눈다 */
    .data-table td {
        display: flex; justify-content: space-between; align-items: center; gap: 12px;
        border: none; border-bottom: 1px solid var(--row-line);
        padding: 7px 0; white-space: normal; text-align: right;
    }
    .data-table tr > td:last-child { border-bottom: none; }
    /* 들여쓰기는 표에서만 의미가 있다 — 카드에서는 라벨이 왼쪽 끝에 붙어야 한다 */
    .data-table tr.grp-item > td:first-child { padding-left: 0; }
    /* 라벨은 왼쪽에 고정(auto 마진), 값은 오른쪽에 모인다.
       space-between 만 쓰면 값이 여러 조각(숫자+단위, 이름+배지)일 때 조각들이 양끝으로 흩어진다. */
    .data-table td::before {
        content: attr(data-label);
        color: var(--text-sub); font-weight: 600; font-size: .76rem;
        flex-shrink: 0; text-align: left; margin-right: auto;
    }
    .data-table td:empty::before,
    .data-table td[colspan]::before { content: none; }
    .data-table td[colspan] { display: block; text-align: center; }

    /* 그룹(지사·품목그룹) 헤더 — 카드가 아니라 카드들 위에 얹히는 구획 라벨 */
    .data-table tr.tbl-group-head,
    .data-table tr.grp-row {
        background: none; border: none; box-shadow: none;
        padding: 16px 2px 6px; margin: 0;
    }
    .data-table tr.tbl-group-head > td,
    .data-table tr.grp-row > td {
        background: none !important; box-shadow: none; border: none;
        border-left: 3px solid var(--primary);
        text-align: left; font-size: .84rem; font-weight: 800;
        color: var(--text); letter-spacing: .02em; padding: 1px 0 1px 9px;
    }
    /* 펼친 카드 — 강조선은 카드 왼쪽 전체에 (표에서 쓰던 첫 칸 inset 은 카드에선 어색하다) */
    .data-table tr.is-expanded {
        background: color-mix(in srgb, var(--primary) 5%, var(--surface));
        border-left: 3px solid var(--primary); padding-left: 11px;
    }
    .data-table tr.is-expanded > td {
        background: none; box-shadow: none; border-bottom-color: var(--row-line);
    }
    .data-table tr.is-expanded > td:last-child { border-bottom: none; }

    /* 소계 — 카드 아래 붙는 한 줄 요약(라벨 좌 / 금액 우) */
    .data-table tr.tbl-subtotal {
        background: none; border: none; box-shadow: none;
        display: flex; justify-content: space-between; align-items: baseline;
        gap: 12px; padding: 8px 4px 2px; margin: 0 0 4px;
    }
    .data-table tr.tbl-subtotal > td {
        display: block; padding: 0; text-align: right;
        background: none; border: none;
    }
    /* 소계 줄은 왼쪽 라벨(colspan 칸)이 이미 '○○ 소계'라 data-label 을 또 붙이면 '소계750,000 원'이 된다 */
    .data-table tr.tbl-subtotal > td::before { content: none; }
    .data-table tr.tbl-subtotal td[colspan] {
        text-align: left; font-size: .78rem; color: var(--text-sub);
    }

    /* 카드 첫 줄(대상 이름)은 라벨 없이 카드 제목처럼 */
    .data-table td.tbl-row-head {
        display: block; text-align: left;
        font-size: .95rem; font-weight: 700; color: var(--text);
        padding: 0 0 8px; margin-bottom: 6px;
        border-bottom: 1px solid var(--border);
    }
    .data-table td.tbl-row-head::before { content: none; }

    /* 카드 마지막 줄(합계)은 구분선 위에 강조 */
    .data-table td.tbl-row-total {
        margin-top: 6px; padding-top: 8px;
        border-top: 1px solid var(--border); font-weight: 700;
    }
}

/* ─────────────────────────────────────────────
   KPI 요약 타일 (웹 콘솔 공용) — 매출 조회 화면과 동일 룩
   ───────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.kpi-grid.kpi-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-grid.kpi-2 { grid-template-columns: repeat(2, 1fr); }
.kpi-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 14px 16px;
}
.kpi-card--accent { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.kpi-label { font-size: .76rem; color: var(--text-sub); font-weight: 600; }
.kpi-value {
    font-size: 1.45rem; font-weight: 700; color: var(--text);
    margin-top: 6px; line-height: 1.15; letter-spacing: -.02em;
}
.kpi-value .unit { font-size: .9rem; font-weight: 600; color: var(--text-sub); margin-left: 2px; }
.kpi-value.pos { color: var(--success); }
.kpi-value.neg { color: var(--danger); }

/* 월 이동 툴바 (여러 콘솔 페이지 공용) */
.month-nav { display: flex; align-items: center; gap: 10px; margin: 1rem 0; flex-wrap: wrap; }

/* 내역 화면 공통 대상 필터 (전체/지사/점장) */
.staff-filter { margin: 0 0 1rem; }
.staff-filter-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.staff-filter-label { font-size: .82rem; font-weight: 600; color: var(--text-sub); }
.staff-filter-form select { min-width: 220px; }
.staff-filter-hint { font-size: .82rem; color: var(--text-sub); }

@media (max-width: 639.98px) {
    .kpi-grid, .kpi-grid.kpi-3, .kpi-grid.kpi-2 { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .kpi-value { font-size: 1.2rem; }
    .kpi-card { padding: 12px 13px; }
}

/* ── 표 페이지네이션 (data-paginate, main.js가 자동 생성) ── */
.tbl-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.tbl-toolbar-left { display: flex; align-items: center; gap: 12px; }
.tbl-count { font-size: .9rem; color: var(--primary); font-weight: 600; white-space: nowrap; }
.tbl-count strong { color: var(--text); }
.tbl-pagesize {
    height: 36px;
    padding: 0 8px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: .85rem;
}
.tbl-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.tbl-pagination button {
    min-width: 34px; height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 8px;
    font-size: .82rem;
    cursor: pointer;
}
.tbl-pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tbl-pagination button:disabled { opacity: .4; cursor: default; }
.tbl-ellipsis { padding: 0 4px; color: var(--text-sub); }

/* ── 모바일에서 감추는 것 ──
   엑셀 다운로드는 파일을 받아 표 도구로 여는 작업이라 폰에서는 쓸 자리가 없다.
   .hide-mobile 은 버튼(onclick)용, a[href*="/excel"] 은 링크형 내려받기를 자동으로 덮는다. */
@media (max-width: 639.98px) {
    .hide-mobile,
    a[href*="/excel"] { display: none !important; }
}

/* 수량 칸: 숫자와 단위(26 + 개)는 한 덩어리 —
   카드 모드에서 td 가 flex(space-between) 라 그냥 두면 둘이 양끝으로 갈라진다. */
@media (max-width: 639.98px) {
    /* td 의 flex gap(12px) 이 숫자와 단위 사이에도 들어가 '1,240   개' 로 벌어진다 →
       라벨은 ::before 의 auto 마진이 밀어내므로 gap 은 0 이어도 된다 */
    .data-table td.qty-cell { gap: 0; }
}
