/* ══════════════════════════════════════════════
   재고관리 시스템 CSS
   ══════════════════════════════════════════════ */

/* ── 리셋 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:   #3b5bdb;
  --primary-d: #2f4ac7;
  --success:   #2f9e44;
  --danger:    #e03131;
  --warn:      #e67700;
  --sidebar-bg:#1e1e2e;
  --sidebar-w: 220px;
  --header-h:  52px;
  --gray-50:   #f8f9fa;
  --gray-100:  #f1f3f5;
  --gray-200:  #e9ecef;
  --gray-400:  #ced4da;
  --gray-600:  #868e96;
  --gray-800:  #343a40;
  --text:      #212529;
  --radius:    8px;
  --shadow:    0 2px 10px rgba(0,0,0,.08);
}

body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
       background: var(--gray-100); color: var(--text); font-size: 14px; }

a { text-decoration: none; color: inherit; }

/* ── 유틸 ── */
.hidden   { display: none !important; }
.w-full   { width: 100%; }
.mt-8     { margin-top: .8rem; }
.msg-error   { color: var(--danger); font-size: .8rem; margin-top: .35rem; }
.msg-success { color: var(--success); font-size: .8rem; margin-top: .35rem; }
.empty    { text-align: center; color: var(--gray-600); padding: 2rem !important; }

/* ── 버튼 ── */
.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem 1rem; border: none; border-radius: var(--radius);
  cursor: pointer; font-size: .875rem; font-weight: 500; transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-ghost    { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-400); }
.btn-sm       { padding: .3rem .65rem; font-size: .8rem; }
.btn-xs       { padding: .2rem .5rem;  font-size: .75rem; }

/* ── 입력 ── */
.field        { margin-bottom: .9rem; }
.field label  { display: flex; align-items: center; gap: .4rem;
                font-size: .82rem; font-weight: 600; color: var(--gray-800); margin-bottom: .3rem; }
.field .hint  { font-weight: 400; color: var(--gray-600); font-size: .75rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: .55rem .8rem; border: 1px solid var(--gray-400);
  border-radius: var(--radius); font-size: .875rem; transition: border-color .15s;
  background: #fff; color: var(--text);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); }

/* ── form-control (범용 입력 스타일) ── */
.form-control {
  display: block; width: 100%;
  padding: .48rem .75rem;
  border: 1px solid var(--gray-400);
  border-radius: var(--radius);
  font-size: .875rem; font-family: inherit;
  color: var(--text); background: #fff;
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,91,219,.12);
}
.form-control::placeholder { color: var(--gray-400); }
.form-control[readonly] { background: var(--gray-50); cursor: default; }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 70px; }

/* ── 화면 전환 ── */
.screen { display: none; }
.screen.active { display: flex; }

/* ── 로그인 / 회원가입 ── */
#screen-login, #screen-register {
  min-height: 100vh; justify-content: center; align-items: center;
  background: linear-gradient(135deg, #1e1e2e 0%, #2d2b55 100%);
}
.auth-card {
  background: #fff; border-radius: 14px; padding: 2.5rem 2.2rem;
  width: 100%; max-width: 400px; box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.auth-logo  { text-align: center; font-size: 2.5rem; margin-bottom: .5rem; }
.auth-title { text-align: center; font-size: 1.3rem; font-weight: 700;
              color: var(--text); margin-bottom: 1.75rem; }
.auth-footer { margin-top: 1.2rem; text-align: center; font-size: .82rem; color: var(--gray-600); }
.auth-footer a { color: var(--primary); font-weight: 600; }

/* ── 메인 레이아웃 ── */
#screen-main.layout { flex-direction: row; min-height: 100vh; width: 100%; }

/* ── 사이드바 ── */
#sidebar {
  width: var(--sidebar-w); min-height: 100vh; background: var(--sidebar-bg);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-top {
  padding: 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-logo {
  font-weight: 700; font-size: .95rem; color: #fff; white-space: nowrap;
}
.nav-list  { list-style: none; padding: .6rem 0; flex: 1; }
.nav-list li { margin: .05rem .5rem; }
.nav-link  {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .75rem; border-radius: var(--radius);
  color: #a8b2d8; font-size: .875rem; cursor: pointer; transition: background .15s, color .15s;
}
.nav-link:hover   { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active  { background: var(--primary); color: #fff; }
.nav-icon { font-size: 1rem; width: 1.2rem; text-align: center; flex-shrink: 0; }
.nav-text { white-space: nowrap; }

/* 접기/펼치기 그룹 메뉴 */
.nav-group { margin: .05rem .5rem; }
.nav-group-header {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .75rem; border-radius: var(--radius);
  color: #a8b2d8; font-size: .875rem; cursor: pointer;
  transition: background .15s, color .15s; user-select: none;
}
.nav-group-header:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-group-header.active-parent { color: #fff; background: rgba(255,255,255,.06); }
.nav-group-arrow {
  margin-left: auto; font-size: .7rem; transition: transform .2s; display: inline-block;
}
.nav-group.collapsed .nav-group-arrow { transform: rotate(-90deg); }
.nav-sub-list { list-style: none; padding: .1rem 0 .25rem 0; overflow: hidden; }
.nav-group.collapsed .nav-sub-list { display: none; }
.nav-sub-link {
  padding: .48rem .75rem .48rem 2.4rem !important;
  font-size: .835rem !important;
}

.sidebar-bottom {
  padding: .85rem 1rem; border-top: 1px solid rgba(255,255,255,.07);
  display: flex; flex-direction: column; gap: .5rem;
}
.user-badge { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
#sb-user-name { font-size: .82rem; color: #c9d1e9; font-weight: 600; }

/* ── 콘텐츠 영역 ── */
.content-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ── 상단 헤더 ── */
.top-header {
  height: var(--header-h); background: #fff; border-bottom: 1px solid var(--gray-200);
  padding: 0 1.5rem; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.top-header-left { font-weight: 700; font-size: 1rem; color: var(--text); }
.top-header-right { display: flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--gray-600); }
#hdr-user { font-weight: 600; color: var(--text); }

/* ── 페이지 ── */
#pages { flex: 1; padding: 1.5rem; overflow-y: auto; }
.page { display: none; }
.page.active { display: block; }

/* ── 대시보드 통계 ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; }
.stat-card {
  background: #fff; border-radius: 12px; padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow); border-left: 4px solid var(--primary);
}
.stat-card.stat-warn   { border-left-color: var(--warn); }
.stat-card.stat-danger { border-left-color: var(--danger); }
.stat-label { font-size: .78rem; color: var(--gray-600); margin-bottom: .4rem; font-weight: 500; }
.stat-value { font-size: 1.9rem; font-weight: 800; color: var(--primary); }
.stat-card.stat-warn   .stat-value { color: var(--warn); }
.stat-card.stat-danger .stat-value { color: var(--danger); }

/* ── Placeholder ── */
.placeholder-msg {
  text-align: center; padding: 5rem 2rem; color: var(--gray-600);
  font-size: 1.2rem; line-height: 2;
}
.placeholder-msg small { font-size: .85rem; }

/* ── 역할 뱃지 ── */
.role-chip {
  display: inline-block; padding: .15rem .55rem; border-radius: 99px;
  font-size: .7rem; font-weight: 700; letter-spacing: .02em;
}
.role-pending { background: #e9ecef; color: #495057; }
.role-viewer  { background: #d0ebff; color: #1864ab; }
.role-editor  { background: #d3f9d8; color: #1b5e20; }
.role-admin   { background: #ffe3e3; color: #c92a2a; }

/* ── 탭 ── */
.tabs {
  display: flex; gap: .5rem; margin-bottom: 1.2rem;
  border-bottom: 2px solid var(--gray-200); padding-bottom: 0;
}
.tab {
  padding: .55rem 1.2rem; background: none; border: none; cursor: pointer;
  font-size: .875rem; color: var(--gray-600); font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff; border-radius: 99px;
  font-size: .7rem; font-weight: 700; min-width: 1.2rem; height: 1.2rem; padding: 0 .3rem;
}

/* ── 테이블 ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: collapse; background: #fff; }
.tbl thead tr { background: var(--gray-50); }
.tbl th {
  padding: .75rem 1rem; text-align: left; font-size: .78rem; font-weight: 700;
  color: var(--gray-600); text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 2px solid var(--gray-200); white-space: nowrap;
}
.tbl td {
  padding: .7rem 1rem; font-size: .875rem; border-bottom: 1px solid var(--gray-100);
  white-space: nowrap;
}
.tbl tbody tr:hover { background: var(--gray-50); }
.tbl tbody tr:last-child td { border-bottom: none; }

/* ── 상세 테이블 (세로스크롤 + 상단 미러 스크롤바) ── */
.ib-tbl-scroll-top {
  overflow-x: auto; overflow-y: hidden;
  height: 14px; margin-top: .5rem;
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--gray-200); border-bottom: none;
}
.ib-tbl-scroll-inner { height: 1px; }
.ib-detail-table-wrap {
  max-height: 60vh; overflow-y: auto; overflow-x: auto;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
}
.ib-detail-table-wrap .tbl { table-layout: fixed; min-width: 1210px; }
.ib-detail-table-wrap td {
  white-space: normal; word-break: break-all; vertical-align: top;
}
.ib-td-notes { vertical-align: top; }
.ib-td-spec  { font-size: .82rem; color: var(--gray-700); }

/* ── 제너릭 듀얼 스크롤 (상단 + 하단 가로 스크롤바 연동) ── */
.dual-scroll-top {
  overflow-x: auto; overflow-y: hidden;
  height: 14px;
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--gray-200); border-bottom: none;
}
.dual-scroll-inner { height: 1px; }
.dual-scroll-wrap {
  overflow-x: auto; overflow-y: auto;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
}
.dual-scroll-wrap thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--gray-50);
}

/* 출고 상세 테이블 */
.ob-detail-tbl { table-layout: fixed; min-width: 1100px; }
.ob-detail-tbl td { white-space: normal; word-break: break-all; vertical-align: top; }

/* 반품/교환 상세 테이블 */
.rt-detail-tbl { table-layout: fixed; }
.rt-detail-tbl td { white-space: normal; word-break: break-all; vertical-align: top; }

/* 폼 테이블 래퍼 (직접입력 + 엑셀 미리보기) */
.ib-form-table-wrap {
  overflow-x: auto; overflow-y: visible;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
}
.ib-form-table-wrap .tbl { table-layout: fixed; }

/* 처리구분 배지 */
.ib-cond-defective { background: #ffe8cc; color: #e67700; }
.ib-cond-disposal  { background: #f3d9fa; color: #862e9c; }

/* 상품유형 토글 */
.ib-type-toggle {
  display: inline-flex; border: 1px solid var(--gray-400);
  border-radius: 6px; overflow: hidden; width: 100%;
}
.ib-type-btn {
  flex: 1; padding: .22rem 0; font-size: .75rem; font-weight: 600;
  border: none; background: #fff; cursor: pointer; color: var(--gray-600);
  transition: background .12s, color .12s;
}
.ib-type-btn + .ib-type-btn { border-left: 1px solid var(--gray-400); }
.ib-type-btn.active { background: var(--primary); color: #fff; }
.ib-type-btn:not(.active):hover { background: var(--gray-100); }

/* 스펙 입력 (숨김/표시) */
.ib-spec-inp.hidden { display: none; }
.ib-spec-cell { min-width: 0; }

/* ── 출고거래처: 별 / 계좌 / 필터 ── */
.v-star-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.4rem; line-height: 1; padding: 0 .2rem;
  color: var(--gray-400); transition: color .15s, transform .1s;
}
.v-star-btn:hover { color: #f59f00; transform: scale(1.15); }
.v-star-btn.star-active { color: #f59f00; }

.v-star-mark { color: #f59f00; font-size: .95em; }

.v-star-row {
  display: flex; align-items: center; gap: .4rem;
  margin-bottom: .75rem; padding: .4rem .6rem;
  background: #fffbe6; border-radius: var(--radius);
  border: 1px solid #ffe066;
}
.v-star-label { font-size: .82rem; color: var(--gray-600); }

.v-section-divider {
  font-size: .78rem; font-weight: 700; color: var(--gray-600);
  text-transform: uppercase; letter-spacing: .06em;
  margin: 1rem 0 .5rem;
  padding-bottom: .3rem; border-bottom: 1px solid var(--gray-200);
}

/* ── 거래처 상세보기 필드 (수정 폼과 동일한 레이아웃) ── */
.vdd-field {
  margin-bottom: .75rem;
}
.vdd-label {
  font-size: .82rem; font-weight: 600; color: var(--gray-700);
  margin-bottom: .25rem;
}
.vdd-value {
  padding: .5rem .75rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .875rem; color: var(--text);
  min-height: 2.25rem; line-height: 1.5;
  word-break: break-word;
}
.vdd-value-multi {
  min-height: 5rem; white-space: pre-wrap;
}
.vdd-acc-row {
  display: flex; align-items: center; gap: .5rem;
}
.vdd-meta {
  display: flex; flex-wrap: wrap; gap: .3rem 1.5rem;
  margin-top: 1rem; padding-top: .75rem;
  border-top: 1px solid var(--gray-100);
  font-size: .78rem; color: var(--gray-600);
}

/* 출고거래처 필터 버튼 */
.svendor-filter-bar {
  display: flex; gap: .4rem; margin-bottom: .75rem;
}
.svendor-filter-btn {
  padding: .3rem .9rem; border-radius: 20px;
  border: 1.5px solid var(--gray-200); background: #fff;
  font-size: .82rem; font-weight: 500; cursor: pointer;
  color: var(--gray-600); transition: all .15s;
}
.svendor-filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.svendor-filter-btn.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

/* 권한 변경 셀 내 셀렉트 */
.role-select {
  padding: .25rem .5rem; border-radius: 5px; border: 1px solid var(--gray-400);
  font-size: .8rem; background: #fff; cursor: pointer; margin-right: .4rem;
}

/* ── 토스트 ── */
#toast-wrap {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: .5rem; z-index: 9999;
}
.toast {
  padding: .8rem 1.2rem; border-radius: var(--radius); font-size: .875rem;
  font-weight: 500; box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: slide-in .2s ease; min-width: 220px; max-width: 340px;
}
.toast-success { background: #2f9e44; color: #fff; }
.toast-error   { background: #e03131; color: #fff; }
.toast-info    { background: #1c7ed6; color: #fff; }
@keyframes slide-in {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── 페이지 툴바 ── */
.page-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; gap: .75rem; flex-wrap: wrap;
}
.search-wrap { flex: 1; min-width: 200px; max-width: 420px; }
.search-input {
  width: 100%; padding: .55rem .9rem; border: 1px solid var(--gray-400);
  border-radius: var(--radius); font-size: .875rem; background: #fff;
}
.search-input:focus { outline: none; border-color: var(--primary); }

/* ── 공통 모달 (modal-backdrop / modal-box) ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 900; padding: 1rem;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,.22);
  display: flex; flex-direction: column;
  animation: modalIn .18s ease;
}
@keyframes modalIn {
  from { transform: translateY(18px) scale(.97); opacity: 0; }
  to   { transform: translateY(0)    scale(1);   opacity: 1; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.modal-header h3 {
  font-size: 1rem; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.modal-body {
  padding: 1.25rem 1.4rem; overflow-y: auto; flex: 1;
}
.modal-footer {
  display: flex; justify-content: flex-end; gap: .6rem;
  padding: .9rem 1.25rem;
  border-top: 1px solid var(--gray-200); flex-shrink: 0;
}

/* ── 공통 탭 (tab-bar / tab-btn) ── */
.tab-bar {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--gray-200);
}
.tab-btn {
  padding: .5rem 1rem;
  background: none; border: none; cursor: pointer;
  font-size: .85rem; font-weight: 500; color: var(--gray-600);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active {
  color: var(--primary); font-weight: 700;
  border-bottom-color: var(--primary);
}
.tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.25rem; height: 1.25rem;
  background: var(--gray-200); color: var(--gray-700);
  font-size: .7rem; font-weight: 700; border-radius: 99px;
  padding: 0 .3rem; margin-left: .25rem;
  transition: background .15s, color .15s;
}
.tab-btn.active .tab-count {
  background: #dbe4ff; color: var(--primary);
}

/* ── 공통 데이터 테이블 (data-table) ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: .83rem;
}
.data-table thead tr { background: var(--gray-50); }
.data-table th {
  padding: .5rem .75rem;
  text-align: left;
  font-size: .75rem; font-weight: 600;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}
.data-table td {
  padding: .45rem .75rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── 모달 ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 600px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal.modal-sm { max-width: 400px; }
.modal-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.modal-hd h3 { font-size: 1rem; font-weight: 700; }
.btn-close {
  background: none; border: none; font-size: 1.1rem; cursor: pointer;
  color: var(--gray-600); padding: .2rem .4rem; border-radius: 4px;
  line-height: 1;
}
.btn-close:hover { background: var(--gray-100); }
.modal-bd {
  padding: 1.25rem 1.4rem; overflow-y: auto; flex: 1;
}
.modal-ft {
  display: flex; justify-content: flex-end; gap: .6rem;
  padding: 1rem 1.4rem; border-top: 1px solid var(--gray-200); flex-shrink: 0;
}

/* ── 모달 폼 레이아웃 ── */
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.req  { color: var(--danger); font-weight: 700; }
.label-with-check { display: flex; align-items: center; gap: .75rem; }
.check-inline { display: flex; align-items: center; gap: .3rem;
                font-weight: 400; font-size: .82rem; color: var(--gray-600); cursor: pointer;
                white-space: nowrap; }
.check-inline input { margin: 0; cursor: pointer; }

/* ── 테이블 셀 ── */
.cell-addr, .cell-notes {
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cell-date  { white-space: nowrap; color: var(--gray-600); font-size: .8rem; }
.cell-action { white-space: nowrap; }
.cell-action .btn + .btn { margin-left: .3rem; }
.cell-empty { color: var(--gray-400); }
.license-link { color: #228be6; text-decoration: none; white-space: nowrap; }
.license-link:hover { text-decoration: underline; }

/* ── 행 클릭 ── */
.vendor-row { cursor: pointer; }
.vendor-row:hover { background: var(--primary-light, #eef2ff); }

/* ── 거래처 상세 보기 ── */
.detail-dl { display: flex; flex-direction: column; }
.detail-row {
  display: grid; grid-template-columns: 130px 1fr;
  padding: .65rem 0; border-bottom: 1px solid var(--gray-100); align-items: start; gap: .5rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-row dt { font-size: .82rem; font-weight: 600; color: var(--gray-600); padding-top: .1rem; }
.detail-row dd { font-size: .9rem; color: var(--text); white-space: pre-wrap; word-break: break-word; }

.detail-meta {
  margin-top: .9rem; padding-top: .75rem; border-top: 2px solid var(--gray-200);
  display: flex; flex-direction: column; gap: .35rem;
}
.detail-meta-row { display: flex; gap: 2.5rem; flex-wrap: wrap; }
.meta-label { font-size: .78rem; font-weight: 600; color: var(--gray-600); margin-right: .35rem; }
.detail-meta-row span { font-size: .82rem; }

/* ── 삭제 확인 바 ── */
.delete-confirm-bar {
  background: #fff5f5 !important;
  border-top: 1px solid #ffc9c9 !important;
}
.delete-confirm-text { color: var(--danger); font-size: .875rem; font-weight: 600; }

/* ── 거래처 선택 팝업 행 ── */
.picker-row { cursor: pointer; }
.picker-row:hover td { background: #e8f0fe; }

/* ══════════════════════════════════════════════
   입고 관리
   ══════════════════════════════════════════════ */

/* 3열 폼 그리드 */
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }

/* 입력+버튼 나란히 */
.input-with-btn { display: flex; gap: .4rem; }
.input-with-btn input { flex: 1; padding: .55rem .8rem; border: 1px solid var(--gray-400);
  border-radius: var(--radius); font-size: .875rem; background: #fff; }
.input-with-btn input:focus { outline: none; border-color: var(--primary); }

/* 헤더 카드 */
.ib-header-card {
  background: #fff; border-radius: var(--radius); padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow); margin-bottom: 1rem;
}

/* 매입 카드 목록 */
#ib-cards { display: flex; flex-direction: column; gap: .65rem; }
.ib-card {
  background: #fff; border-radius: var(--radius); padding: 1rem 1.25rem;
  box-shadow: var(--shadow); cursor: pointer; transition: box-shadow .15s, transform .1s;
  border-left: 4px solid var(--primary);
}
.ib-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,.13); transform: translateY(-1px); }
.ib-card-top {
  display: flex; align-items: center; gap: .75rem; margin-bottom: .4rem; flex-wrap: wrap;
}
.ib-card-date   { color: var(--gray-500); font-size: .82rem; }
.ib-card-vendor { font-weight: 700; font-size: 18px; color: var(--text); }
.ib-card-badges { display: flex; gap: .3rem; flex-wrap: wrap; margin-left: auto; }
.ib-card-summary { font-size: .82rem; color: var(--gray-800); margin-bottom: .35rem; }
.ib-card-total  { font-size: .82rem; color: var(--gray-600); }
.ib-card-total b { color: var(--primary); }

/* 상태 뱃지 */
.ib-badge {
  display: inline-block; padding: .12rem .5rem; border-radius: 99px;
  font-size: .72rem; font-weight: 700; white-space: nowrap;
}
.ib-badge-completed { background: #d3f9d8; color: #1b5e20; }
.ib-badge-pending   { background: #e9ecef; color: #495057; }
.ib-badge-priority  { background: #fff3cd; color: #856404; }

/* 스마트스토어 버튼 */
.btn-ss-off {
  background: transparent; color: #16a34a;
  border: 1px solid #16a34a; font-size: .75rem;
  padding: .2rem .55rem; border-radius: var(--radius);
  cursor: pointer; white-space: nowrap;
}
.btn-ss-off:hover { background: #f0fdf4; }
.btn-ss-on {
  background: #16a34a; color: #fff;
  border: 1px solid #16a34a; font-size: .75rem;
  padding: .2rem .55rem; border-radius: var(--radius);
  cursor: pointer; white-space: nowrap;
}
.btn-ss-on:hover { background: #15803d; }
.ib-ss-icon { margin-left: .25rem; font-size: .9rem; vertical-align: middle; }

/* 상세 헤더 */
.ib-detail-header {
  background: #fff; border-radius: var(--radius); padding: 1rem 1.25rem;
  box-shadow: var(--shadow); margin-bottom: .85rem;
}
/* detail-dl 를 2열 그리드로 */
.ib-detail-header .detail-dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.5rem;
}
.ib-detail-header .detail-row {
  padding: .45rem 0;
  border-bottom: 1px solid var(--gray-100);
  grid-template-columns: 90px 1fr;
}
.ib-detail-header .detail-row:nth-last-child(-n+2) { border-bottom: none; }

/* 일괄 변경 영역 */
.ib-bulk-bar {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .9rem;
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--radius); margin-bottom: .75rem;
}
.ib-bulk-label {
  font-size: .78rem; font-weight: 600; color: var(--gray-600); white-space: nowrap;
}

/* 상세 페이지 일괄 변경 버튼 */
.ib-detail-bulk-btn {
  padding: .32rem .85rem;
  border: 1.5px solid var(--gray-300); border-radius: 99px;
  background: #fff; font-size: .8rem; font-weight: 600; cursor: pointer;
  color: var(--gray-600); transition: all .15s; white-space: nowrap;
}
.ib-detail-bulk-btn:hover { border-color: var(--primary); color: var(--primary); background: #f0f4ff; }
.ib-detail-bulk-btn[data-status="pending"]:hover   { border-color: #868e96; color: #343a40; background: #f1f3f5; }
.ib-detail-bulk-btn[data-status="completed"]:hover { border-color: #2f9e44; color: #1b5e20; background: #ebfbee; }
.ib-detail-bulk-btn[data-status="priority"]:hover  { border-color: #f59f00; color: #856404; background: #fff9db; }
.ib-detail-bulk-btn.active[data-status="pending"]   { background: #e9ecef; border-color: #868e96; color: #343a40; }
.ib-detail-bulk-btn.active[data-status="completed"] { background: #d3f9d8; border-color: #2f9e44; color: #1b5e20; }
.ib-detail-bulk-btn.active[data-status="priority"]  { background: #fff3cd; border-color: #f59f00; color: #856404; }

/* 엑셀/직접입력 탭 컨텐츠 */
.ib-tab-content { margin-top: .75rem; }
.ib-excel-bar {
  display: flex; align-items: center; gap: .6rem; margin-bottom: .65rem; flex-wrap: wrap;
}
.ib-format-guide {
  background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 6px;
  padding: .55rem .85rem; font-size: .8rem; margin-bottom: .65rem;
}
.ib-direct-bar {
  display: flex; align-items: center; gap: .6rem; margin-bottom: .65rem;
}
.ib-form-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 1rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--gray-200);
}
.ib-total-summary { font-size: .875rem; font-weight: 600; color: var(--gray-700); }

/* 직접입력 input 공통 */
.ib-inp {
  width: 100%; padding: .3rem .45rem; border: 1px solid var(--gray-400);
  border-radius: 5px; font-size: .8rem; background: #fff;
}
.ib-inp:focus { outline: none; border-color: var(--primary); }
.ib-status-sel { width: 100%; padding: .3rem .35rem; border: 1px solid var(--gray-400);
  border-radius: 5px; font-size: .78rem; background: #fff; cursor: pointer; }

/* 엑셀 양식 다운로드 노트 */
.ib-template-wrap { display: flex; flex-direction: column; gap: .3rem; }
.ib-template-note {
  font-size: .76rem; color: var(--gray-600); line-height: 1.5;
  background: var(--gray-50); border-left: 3px solid var(--gray-300);
  padding: .3rem .6rem; border-radius: 0 4px 4px 0;
}

/* 엑셀 시각적 안내표 */
.ib-excel-guide {
  margin-bottom: .85rem; border: 1px solid var(--gray-200);
  border-radius: var(--radius); overflow: hidden;
}
.ib-excel-visual {
  width: 100%; border-collapse: collapse; font-size: .8rem;
  table-layout: fixed;
}
.ib-excel-visual thead th {
  background: #e8eaf0; color: var(--gray-700); font-weight: 700;
  padding: .3rem .5rem; text-align: center; border: 1px solid #c8cad8;
}
.ib-excel-visual td { padding: .3rem .5rem; border: 1px solid var(--gray-200); }
.ev-rn {
  width: 3.2rem; text-align: center; background: #e8eaf0;
  color: var(--gray-600); font-weight: 600; font-size: .76rem;
}
.ev-arrow { color: var(--primary); font-weight: 700; }
/* 1행: 회색 배경 (헤더) */
.ev-header td { background: #dde1ea; color: #333; font-weight: 700; text-align: center; }
.ev-header .ev-rn { background: #cdd0da; }
/* 2행: 노란 배경 (첫 데이터) */
.ev-data-first td { background: #fffde7; }
.ev-data-first .ev-rn { background: #e8eaf0; }
/* 3행: 일반 */
.ev-data td { background: #fff; }
.ev-data .ev-rn { background: #e8eaf0; }
/* 배지 */
.ev-badge {
  font-size: .72rem; white-space: nowrap; padding: .15rem .5rem;
  border-radius: 99px; font-weight: 700; text-align: center;
}
.ev-badge-lock  { background: #dee2e6; color: #495057; }
.ev-badge-start { background: #fff3cd; color: #856404; }
/* 팁 */
.ib-excel-tips {
  display: flex; flex-wrap: wrap; gap: .4rem .9rem;
  padding: .55rem .85rem; background: #f8f9fa;
  border-top: 1px solid var(--gray-200); font-size: .8rem; color: var(--gray-700);
}

/* 엑셀 오류 바 */
.ib-excel-error-bar {
  background: #fff5f5; border: 1px solid #ffc9c9; border-radius: var(--radius);
  padding: .6rem .9rem; margin-bottom: .6rem; color: var(--danger);
}
.ib-excel-error-bar b { display: block; margin-bottom: .3rem; font-size: .85rem; }
.ib-err-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: .15rem;
}
.ib-err-list li { font-size: .8rem; padding-left: .8rem; }
.ib-err-list li::before { content: '•'; margin-right: .3rem; }

/* 목록 상단 상태 탭 */
.ib-status-tabs {
  display: flex; gap: .3rem; margin-bottom: .85rem; flex-wrap: wrap;
}
.ib-stab {
  padding: .3rem .85rem; border: 1px solid var(--gray-300); border-radius: 99px;
  background: #fff; font-size: .8rem; font-weight: 600; cursor: pointer;
  color: var(--gray-600); transition: all .15s;
}
.ib-stab:hover { border-color: var(--primary); color: var(--primary); }
.ib-stab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 등록 폼 상단 매입상태 버튼 */
.ib-bulk-btns {
  display: flex; gap: .4rem;
}
.ib-bulk-btn {
  flex: 1; padding: .42rem .6rem; border: 1.5px solid var(--gray-300); border-radius: 7px;
  background: #fff; font-size: .82rem; font-weight: 600; cursor: pointer;
  color: var(--gray-600); transition: all .15s; text-align: center;
}
.ib-bulk-btn:hover { border-color: var(--primary); color: var(--primary); }
.ib-bulk-btn.active[data-status="pending"]   { background: #e9ecef; border-color: #868e96; color: #343a40; }
.ib-bulk-btn.active[data-status="completed"] { background: #d3f9d8; border-color: #2f9e44; color: #1b5e20; }
.ib-bulk-btn.active[data-status="priority"]  { background: #fff3cd; border-color: #f59f00; color: #856404; }

/* 우선등록 행 강조 */
.ib-row-priority td { background: #fffbeb !important; }
.ib-row-priority td:first-child { border-left: 3px solid #f59f00; }

/* 날짜 범위 + 키워드 검색 바 */
.ib-filter-bar {
  display: flex; align-items: center; gap: .6rem;
  margin-bottom: .85rem; flex-wrap: wrap;
}
.ib-date-range {
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
}
.ib-date-inp {
  width: 7.2rem; padding: .42rem .6rem; border: 1px solid var(--gray-400);
  border-radius: var(--radius); font-size: .85rem; background: #fff;
}
.ib-date-inp:focus { outline: none; border-color: var(--primary); }
.ib-range-sep { color: var(--gray-500); font-size: .85rem; }
.ib-quick-btn {
  padding: .3rem .65rem; border: 1px solid var(--gray-300); border-radius: 99px;
  background: #fff; font-size: .78rem; font-weight: 600; cursor: pointer;
  color: var(--gray-600); white-space: nowrap; transition: all .15s;
}
.ib-quick-btn:hover { border-color: var(--primary); color: var(--primary); background: #f0f4ff; }
.ib-quick-clear { color: var(--danger); border-color: var(--danger); }
.ib-quick-clear:hover { background: #fff5f5; }
.ib-keyword-inp { flex: 1; min-width: 10rem; }

/* 메모 카드 */
.ib-memo-card {
  background: #fffdf0;
  border: 1px solid #f0e080;
  border-left: 4px solid #f0c000;
  border-radius: var(--radius);
  padding: .8rem 1rem; margin-bottom: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.ib-memo-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; margin-bottom: .5rem;
}
.ib-memo-title {
  display: flex; align-items: center; gap: .4rem;
  font-weight: 700; font-size: .85rem; color: #7a5900;
}
.ib-memo-meta  { font-size: .73rem; color: var(--gray-500); }
.ib-memo-textarea {
  width: 100%; min-height: 3.5rem; max-height: 10rem;
  padding: .5rem .7rem;
  border: 1px solid #e6d96a; border-radius: 6px;
  font-size: .875rem; background: #ffffe8;
  resize: vertical; font-family: inherit; line-height: 1.55;
  box-sizing: border-box; transition: border-color .15s, background .15s;
}
.ib-memo-textarea::placeholder { color: #b8a040; }
.ib-memo-textarea:focus { outline: none; border-color: #c9a800; background: #fff; box-shadow: 0 0 0 3px rgba(240,192,0,.15); }

/* ══════════════════════════════════════════════
   출고 관리
   ══════════════════════════════════════════════ */

/* 출고 카드 목록 */
#ob-cards { display: flex; flex-direction: column; gap: .65rem; }
.ob-card  { border-left-color: #f03e3e; }  /* 출고 = 빨간 액센트 */
.ob-card-hd {
  display: flex; align-items: center; gap: .65rem;
  margin-bottom: .4rem; flex-wrap: wrap;
}
.ob-card-total { font-weight: 700; font-size: .9rem; color: #f03e3e; margin-left: auto; }
.ob-card-body {
  font-size: .875rem; color: var(--gray-800); margin-bottom: .3rem;
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
}
.ob-card-ft {
  display: flex; gap: 1.1rem; font-size: .82rem; color: var(--gray-600);
  flex-wrap: wrap;
}
.ob-card-ft b { color: var(--text); }
.ob-spec-badge {
  display: inline-block; padding: .1rem .45rem; border-radius: 99px;
  background: #e7f5ff; color: #1971c2; font-size: .72rem; font-weight: 600;
}
.ob-cat-chip {
  display: inline-block; padding: .1rem .45rem; border-radius: 99px;
  background: #f3f0ff; color: #7048e8; font-size: .72rem; font-weight: 600;
}
.ob-profit-pos { color: #2f9e44; }
.ob-profit-neg { color: #e03131; }

/* 출고 condition_type 뱃지 */
.ob-cond-badge {
  display: inline-block; font-size: .72rem; font-weight: 600;
  padding: .15rem .45rem; border-radius: 99px; white-space: nowrap;
}
.ob-cond-normal    { background: #ebfbee; color: #2b8a3e; }
.ob-cond-defective { background: #fff5f5; color: #e03131; }
.ob-cond-disposal  { background: #f1f3f5; color: #868e96; }
.ob-cell-cond { text-align: center; }

/* 출고 상세 그리드 */
.ob-detail-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; margin-bottom: .5rem;
}
.ob-dfield { }
.ob-dlabel {
  font-size: .78rem; font-weight: 600; color: var(--gray-600); margin-bottom: .2rem;
}
.ob-dvalue {
  padding: .45rem .7rem; background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--radius); font-size: .875rem; min-height: 2.1rem;
}

/* 등록 폼 읽기전용 입력 */
.ob-input-readonly {
  width: 100%; padding: .55rem .8rem; border: 1px solid var(--gray-200);
  border-radius: var(--radius); font-size: .875rem;
  background: var(--gray-50); color: var(--gray-600); cursor: default;
}

/* 재고/이익 정보 바 */
.ob-stock-info-bar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  margin-top: .5rem; padding: .55rem .9rem;
  background: #f0f4ff; border: 1px solid #bac8ff;
  border-radius: var(--radius); font-size: .82rem; color: var(--gray-700);
}
.ob-si-item strong { color: var(--text); font-weight: 700; }
.ob-si-sep { color: var(--gray-400); }

/* ══════════════════════════════════════════════
   출고 관리 v2 스타일
   ══════════════════════════════════════════════ */

/* 출고 카드 */
.ob-card {
  border-left: 3px solid #e03131;
  cursor: pointer;
}
.ob-card-hd {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: .35rem;
}
.ob-card-body {
  font-size: .85rem; color: var(--gray-700); margin-bottom: .3rem;
}
.ob-card-ft {
  display: flex; gap: 1rem; font-size: .8rem; color: var(--gray-600);
}
.ob-card-total {
  font-weight: 700; font-size: .92rem; color: var(--text);
}

/* 거래처 인라인 드롭다운 */
.ob-vendor-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 1500;
  background: #fff; border: 1px solid var(--gray-300);
  border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,.12);
  max-height: 220px; overflow-y: auto;
}
.ob-vendor-item {
  padding: .5rem .75rem; cursor: pointer; font-size: .875rem;
  border-bottom: 1px solid var(--gray-100);
}
.ob-vendor-item:last-child { border-bottom: none; }
.ob-vendor-item:hover { background: var(--gray-50); }
.ob-vendor-new { color: var(--primary); font-weight: 500; border-top: 1px dashed var(--gray-200); }
.ob-vendor-empty { padding: .5rem .75rem; font-size: .875rem; color: var(--gray-500); }
.ob-vendor-unreg { color: var(--primary); font-size: .82rem; border-top: 1px dashed var(--gray-200); }
.ob-new-vendor-badge {
  padding: .5rem .75rem; cursor: pointer; font-size: .82rem;
  color: #1971c2; background: #e7f5ff; border-top: 1px solid #bac8ff;
  font-weight: 600;
}
.ob-new-vendor-badge:hover { background: #d0ebff; }

/* 모델명 드롭다운 (fixed position) */
.ob-model-dropdown {
  position: absolute; z-index: 2000;
  background: #fff; border: 1px solid var(--gray-300);
  border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.15);
  max-height: 260px; overflow-y: auto;
}
.ob-model-dropdown .tbl { font-size: .8rem; }
.ob-model-row { cursor: pointer; }
.ob-model-row:hover td { background: #f0f4ff; }
.ob-row-nostock { opacity: .5; cursor: not-allowed; }
.ob-row-nostock td { color: var(--gray-500); }
.ob-stock-zero { color: #e03131; font-weight: 600; }
.ob-dropdown-section td {
  padding: .2rem .6rem; font-size: .72rem; font-weight: 600;
  color: var(--gray-500); background: #f8fafc;
  border-top: 1px solid var(--gray-200); letter-spacing: .03em;
  cursor: default;
}
/* 세금 토글 */
.ob-tax-toggle {
  display: flex; border: 1px solid var(--gray-300); border-radius: var(--radius);
  overflow: hidden; height: 2.25rem;
}
.ob-tax-btn {
  flex: 1; border: none; background: #fff; cursor: pointer;
  font-size: .85rem; font-weight: 500; color: var(--gray-600);
  transition: background .15s, color .15s;
}
.ob-tax-btn:not(:first-child) { border-left: 1px solid var(--gray-300); }
.ob-tax-btn.active {
  background: var(--primary); color: #fff; font-weight: 700;
}
.ob-tax-btn:hover:not(.active) { background: var(--gray-50); }

/* 출고 항목 테이블 입력 */
.ob-items-tbl { table-layout: auto; }
.ob-inp {
  width: 100%; padding: .3rem .45rem;
  border: 1px solid var(--gray-200); border-radius: 4px;
  font-size: .82rem; background: #fff;
  box-sizing: border-box;
}
.ob-inp:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px #dbeafe; }
.ob-inp[type="number"] { text-align: right; }

/* 출고 상세 DL */
.ob-detail-dl {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem;
  margin: 0; padding: 0;
}
.ob-dd-pair { display: flex; flex-direction: column; gap: .15rem; }
.ob-dd-pair dt {
  font-size: .75rem; font-weight: 600; color: var(--gray-600);
}
.ob-dd-pair dd {
  margin: 0; padding: .4rem .65rem;
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--radius); font-size: .875rem;
}

/* 거래명세서 */
.stmt-wrap { max-width: 720px; margin: 0 auto; font-family: 'Malgun Gothic', sans-serif; }
.stmt-title { text-align: center; font-size: 1.4rem; font-weight: 800; margin-bottom: .4rem; }
.stmt-meta { text-align: center; color: var(--gray-600); margin-bottom: 1rem; font-size: .9rem; }
.stmt-parties { display: flex; gap: 1rem; margin-bottom: 1rem; }
.stmt-party { flex: 1; border: 1px solid var(--gray-300); border-radius: var(--radius); padding: .65rem; }
.stmt-party-title { font-weight: 700; margin-bottom: .4rem; border-bottom: 1px solid var(--gray-200); padding-bottom: .3rem; font-size: .88rem; }
.stmt-party-tbl { width: 100%; border-collapse: collapse; font-size: .8rem; }
.stmt-party-tbl td { padding: .25rem .4rem; vertical-align: top; }
.stmt-party-tbl td:first-child { background: #eef2ff; color: var(--primary); width: 80px; font-weight: 600; white-space: nowrap; border-right: 1px solid #c5d0f5; }
.stmt-items-tbl { width: 100%; border-collapse: collapse; }
.stmt-items-tbl th, .stmt-items-tbl td { border: 1px solid var(--gray-300); padding: .4rem .6rem; font-size: .82rem; }
.stmt-items-tbl th { background: var(--gray-50); font-weight: 700; text-align: center; }
.stmt-grand td { background: var(--gray-100); }

/* ══════════════════════════════════════════════
   반품/교환 관리
   ══════════════════════════════════════════════ */

/* 반품/교환 카드 목록 */
#rt-cards { display: flex; flex-direction: column; gap: .65rem; }

/* 유형 뱃지 */
.rt-type-badge {
  display: inline-block; padding: .15rem .55rem; border-radius: 12px;
  font-size: .78rem; font-weight: 700;
}
.rt-type-return   { background: #fff0f0; color: #c92a2a; border: 1px solid #ffc9c9; }
.rt-type-exchange { background: #e8f4ff; color: #1864ab; border: 1px solid #a5d8ff; }

/* 상태 뱃지 (반품/교환 전용) */
.rt-badge-pending          { background: #e9ecef; color: #495057; }
.rt-badge-testing          { background: #fff3cd; color: #856404; }
.rt-badge-normal           { background: #d3f9d8; color: #1b5e20; }
.rt-badge-defective        { background: #ffe8e8; color: #c92a2a; }
.rt-badge-exchange-pending { background: #e8f4ff; color: #1864ab; }
.rt-badge-exchange-done    { background: #d0ebff; color: #1864ab; font-weight: 700; }

/* 섹션 제목 */
.rt-section-title {
  font-weight: 700; font-size: .9rem; color: var(--text);
  margin-bottom: .6rem; padding-bottom: .4rem;
  border-bottom: 2px solid var(--gray-200);
}

/* 출고건 연동 리스트 박스 */
.rt-outbound-list-box {
  border: 1px solid var(--gray-300); border-radius: 6px;
  max-height: 300px; overflow-y: auto; background: #fff;
  margin-top: .35rem;
}
.rt-ob-filter-bar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .5rem .75rem; background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 1;
}
.rt-ob-filter-label { font-size: .78rem; color: var(--gray-600); white-space: nowrap; }
.rt-ob-date-inp {
  border: 1px solid var(--gray-300); border-radius: 4px;
  padding: .2rem .4rem; font-size: .8rem; width: 130px;
}
.rt-ob-loading { padding: .5rem .75rem; font-size: .85rem; color: var(--gray-500); }
.rt-ob-item {
  display: flex; gap: .75rem; align-items: center;
  padding: .5rem .75rem; cursor: pointer; font-size: .85rem;
  border-bottom: 1px solid var(--gray-100);
}
.rt-ob-item:last-child { border-bottom: none; }
.rt-ob-item:hover { background: var(--gray-50); }
.rt-ob-date    { font-weight: 700; color: var(--text); white-space: nowrap; }
.rt-ob-summary { flex: 1; color: var(--gray-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-ob-total   { font-weight: 600; color: var(--primary); white-space: nowrap; }

/* 연동된 출고건 표시 */
.rt-linked-box { margin-top: .35rem; }
.rt-linked-info {
  background: #e8f4ff; border: 1px solid #a5d8ff; border-radius: 6px;
  padding: .45rem .75rem; font-size: .85rem; color: #1864ab;
}

/* 반품/교환 품목 테이블 */
.rt-items-tbl { table-layout: auto; }
.rt-items-tbl .ib-inp { font-size: .83rem; padding: .3rem .4rem; }

/* ══════════════════════════════════════════════
   재고 현황
   ══════════════════════════════════════════════ */

/* ── 요약 카드 바 ── */
.inv-summary-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .6rem;
  margin-bottom: .1rem;
}
.inv-sum-item {
  display: flex; flex-direction: column; gap: .25rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: .7rem 1rem;
  border-left: 4px solid var(--gray-300);
  transition: box-shadow .15s;
}
.inv-sum-item:hover { box-shadow: var(--shadow); }
.inv-sum-item:nth-child(1) { border-left-color: var(--primary); }
.inv-sum-item:nth-child(2) { border-left-color: var(--success); }
.inv-sum-item:nth-child(3) { border-left-color: var(--warn); }
.inv-sum-item:nth-child(4) { border-left-color: var(--danger); }
.inv-sum-item:nth-child(5) { border-left-color: #7048e8; }
.inv-sum-item:nth-child(6) { border-left-color: var(--gray-600); }
.inv-sum-label {
  font-size: .72rem; color: var(--gray-600); white-space: nowrap;
  letter-spacing: -.01em;
}
.inv-sum-val {
  font-size: 1.45rem; font-weight: 700; color: var(--text); line-height: 1;
}
.inv-sum-warn .inv-sum-val  { color: var(--warn); }
.inv-sum-danger .inv-sum-val{ color: var(--danger); }

/* ── 테이블 ── */
.inv-table {
  font-size: .8rem;
  border-collapse: separate;
  border-spacing: 0;
}
.inv-table thead tr {
  background: var(--gray-50);
}
.inv-table th {
  white-space: nowrap;
  padding: .55rem .6rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200);
  position: sticky; top: 0; z-index: 1;
  background: var(--gray-50);
}
/* 수치 컬럼 우정렬 */
.inv-table th:nth-child(n+6):nth-child(-n+14),
.inv-table td:nth-child(n+6):nth-child(-n+14) {
  text-align: right;
  padding-right: .75rem;
}
/* 비고 컬럼 */
.inv-table th:last-child,
.inv-table td:last-child { text-align: left; }

.inv-table td {
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: .45rem .6rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.inv-row { cursor: pointer; transition: background .1s; }
.inv-row:hover { background: #eef2ff; }
.inv-row:hover td { border-bottom-color: #dce4ff; }

/* ── 재고 수치 배지 ── */
.inv-stock-ok {
  display: inline-block;
  min-width: 1.8rem; text-align: center;
  background: #ebfbee; color: #2b8a3e;
  font-weight: 700; font-size: .82rem;
  padding: .15rem .5rem; border-radius: 99px;
}
.inv-stock-zero {
  display: inline-block;
  min-width: 1.8rem; text-align: center;
  background: var(--gray-100); color: var(--gray-600);
  font-size: .82rem;
  padding: .15rem .5rem; border-radius: 99px;
}
.inv-priority-cell {
  display: inline-block;
  background: #fff3bf; color: #e67700;
  font-weight: 600; font-size: .8rem;
  padding: .15rem .5rem; border-radius: 99px;
}
.inv-pending-cell  { color: var(--gray-600); }
.inv-def-cell {
  display: inline-block;
  background: #fff5f5; color: var(--danger);
  font-weight: 600; font-size: .8rem;
  padding: .15rem .5rem; border-radius: 99px;
}
.inv-dis-cell {
  display: inline-block;
  background: #f3f0ff; color: #7048e8;
  font-weight: 600; font-size: .8rem;
  padding: .15rem .5rem; border-radius: 99px;
}

/* ── 임시매입 배지 ── */
.inv-temp-badge {
  font-size: .7rem; cursor: default;
  background: #fff3bf; color: #e67700;
  padding: .1rem .3rem; border-radius: 4px;
  margin-left: .15rem; vertical-align: middle;
}

/* ── 비고 셀 ── */
.inv-notes-cell {
  max-width: 140px; min-width: 80px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--gray-600); font-style: italic; font-size: .78rem;
}

/* ── 상태 배지 ── */
.inv-cond-badge {
  font-size: .73rem;
  padding: .15rem .45rem; border-radius: 99px;
  font-weight: 500;
}
.inv-cond-badge.normal   { background: #ebfbee; color: #2b8a3e; }
.inv-cond-badge.defective{ background: #fff5f5; color: var(--danger); }
.inv-cond-badge.disposal { background: #f3f0ff; color: #7048e8; }
.inv-cond-badge.pending  { background: #e7f5ff; color: #1971c2; }

/* ── 검색 입력 ── */
.inv-search-inp {
  height: 32px; font-size: .82rem; padding: .25rem .5rem;
}

/* ── 스펙 컬럼 ── */
.inv-col-spec { min-width: 56px; color: var(--gray-600); font-size: .78rem; }

/* ── 구분 컬러 뱃지 ── */
.inv-cat-badge {
  display: inline-block;
  font-size: .73rem; font-weight: 700;
  padding: 2px 8px; border-radius: 4px;
}

/* ── 구분 필터 버튼 바 ── */
.inv-cat-filter-bar {
  display: flex; flex-wrap: wrap; gap: .3rem; margin: .35rem 0;
}
.inv-cat-btn {
  font-size: .74rem; padding: 2px 10px; border-radius: 99px;
  border: 1px solid var(--gray-200); background: white; color: var(--gray-500);
  cursor: pointer; transition: all .15s; font-weight: 500; line-height: 1.6;
}
.inv-cat-btn:hover {
  background: var(--icb-bg, var(--gray-100));
  color: var(--icb-col, var(--gray-700));
  border-color: var(--icb-col, var(--gray-300));
}
.inv-cat-btn.active {
  background: var(--icb-bg, var(--gray-800));
  color: var(--icb-col, white);
  border-color: var(--icb-col, var(--gray-800));
  font-weight: 700;
}
.inv-cat-btn[data-catfilter="all"].active {
  background: var(--gray-800); color: white; border-color: var(--gray-800);
}

/* ── 필터 상태 표시 바 ── */
.inv-filter-status {
  display: flex; align-items: center; gap: .6rem;
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px;
  padding: 5px 12px; margin: .3rem 0; font-size: .78rem; color: #1d4ed8;
}
.inv-filter-status.hidden { display: none; }
.inv-filter-reset-btn {
  font-size: .72rem; padding: 2px 10px; border-radius: 99px;
  border: 1px solid #93c5fd; background: white; color: #1d4ed8;
  cursor: pointer; font-weight: 600; transition: all .15s;
}
.inv-filter-reset-btn:hover { background: #1d4ed8; color: white; }

/* ── 구분/브랜드 태그 (레거시 호환) ── */
.inv-cat-tag {
  display: inline-block;
  background: var(--gray-100); color: var(--gray-800);
  font-size: .73rem; font-weight: 600;
  padding: .12rem .45rem; border-radius: 4px;
}
.inv-brand-tag {
  font-size: .8rem; color: var(--gray-600);
}

/* ── 평균매입가 ── */
.inv-price-cell {
  font-variant-numeric: tabular-nums;
  font-size: .8rem; color: var(--gray-800);
}

/* ── 최근거래처 ── */
.inv-vendor-cell {
  max-width: 80px; overflow: hidden; text-overflow: ellipsis;
  font-size: .78rem; color: var(--gray-600);
}

/* ── 재고조정 모달 바디 ── */
.inv-adj-body {
  display: flex; flex-direction: column; gap: .75rem;
  padding: 1.1rem 1.25rem;
}

/* ── 재고 상세 팝업 레이아웃 ── */
.inv-detail-box {
  max-width: 820px; max-height: 88vh;
  display: flex; flex-direction: column;
}
.inv-detail-body {
  flex: 1; overflow-y: auto;
  padding: 1.1rem 1.25rem;
  display: flex; flex-direction: column; gap: 0;
}

/* 비고 영역 */
.inv-notes-wrap {
  margin-bottom: 1rem;
}
.inv-notes-label {
  display: block;
  font-size: .78rem; font-weight: 600;
  color: var(--gray-600);
  margin-bottom: .35rem;
}
.inv-notes-ta {
  font-size: .875rem; resize: vertical;
  min-height: 60px; max-height: 120px;
  line-height: 1.55;
}
.inv-notes-saved {
  font-size: .73rem; color: var(--gray-500); margin-top: .25rem; min-height: 1rem;
}

/* 탭 바 */
.inv-dtab-bar { margin-bottom: .85rem; }

/* 탭 컨텐츠 영역 */
.inv-detail-content {
  min-height: 160px;
}

/* ── 상세/조정 모달 히스토리 테이블 ── */
.inv-hist-tbl {
  font-size: .8rem; width: 100%;
  border-collapse: collapse;
}
.inv-hist-tbl th {
  background: var(--gray-50); white-space: nowrap;
  padding: .45rem .6rem; font-size: .75rem;
  color: var(--gray-600); font-weight: 600;
  border-bottom: 2px solid var(--gray-200);
}
.inv-hist-tbl td {
  white-space: nowrap; padding: .4rem .6rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.inv-hist-tbl tbody tr:hover { background: var(--gray-50); }

/* ── 반응형 ── */
@media (max-width: 768px) {
  :root { --sidebar-w: 56px; }
  .sidebar-logo, .nav-text, .sidebar-bottom .user-badge span:first-child,
  #sb-user-role { display: none; }
  .nav-link { justify-content: center; padding: .65rem; }
  .nav-icon { width: auto; }
  #pages { padding: 1rem; }
  /* 좁은 사이드바: 그룹 헤더 아이콘만 */
  .nav-group-header { justify-content: center; padding: .65rem; }
  .nav-group-arrow  { display: none; }
  .nav-sub-list     { padding: 0; }
  .nav-sub-link     { padding: .48rem .65rem !important; justify-content: center; }
}

/* ════════════════════════════════════════════════════════════════
   판매현황 (8단계)
════════════════════════════════════════════════════════════════ */

/* ── 날짜 범위 ── */
.sl-date-wrap {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
}
.sl-date-inp { width: 130px; height: 32px; padding: .25rem .5rem; font-size: .82rem; }
.sl-date-sep { color: var(--gray-500); font-size: .9rem; }

/* ── 검색 바 ── */
.sl-search-bar {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  padding: .55rem .2rem .4rem;
}
.sl-search-inp { height: 32px; font-size: .82rem; }

/* ── 탭 바 ── */
.sl-tab-bar { margin-bottom: 0; }

/* ── 테이블 래퍼 ── */
.sl-table-wrap {
  overflow-x: auto; overflow-y: auto;
  max-height: calc(100vh - 280px);
  border: 1px solid var(--gray-200);
  border-radius: 0 0 var(--radius) var(--radius);
  flex: 1; min-height: 0;
}

/* ── 판매 테이블 ── */
.sl-table {
  width: 100%; border-collapse: collapse; background: #fff;
  font-size: .82rem;
}
.sl-table thead tr { background: var(--gray-50); }
.sl-table th {
  padding: .5rem .65rem;
  font-size: .73rem; font-weight: 700; color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200); white-space: nowrap;
  text-align: left;
  position: sticky; top: 0; z-index: 2; background: var(--gray-50);
}
.sl-table th.sl-num, .sl-table td.sl-num { text-align: right; }
.sl-table td {
  padding: .4rem .65rem; border-bottom: 1px solid var(--gray-100);
  white-space: nowrap; vertical-align: middle;
}
.sl-table tbody tr:hover { background: var(--gray-50); }
.sl-table td.empty { text-align: center; color: var(--gray-400); padding: 2rem; }

/* ── 행 유형별 배경색 강조 ── */
.sl-row.sl-type-return_deducted { border-left: 3px solid #e03131; background: #fff5f5; color: #c92a2a; }
.sl-row.sl-type-return_deducted td { color: #c92a2a; }
.sl-row.sl-type-exchange        { border-left: 3px solid #f59f00; background: #fffbe6; }
.sl-row.sl-type-exchange td     { color: #856404; }
.sl-row.sl-type-normal          { border-left: 3px solid #2f9e44; background: #ebfbee; }
.sl-row.sl-type-normal td       { color: #1b5e20; }
.sl-row.sl-type-unpaid          { border-left: 3px solid #e8590c; background: #fff4e6; }
.sl-row.sl-type-unpaid td       { color: #c05621; }

/* ── 출고 카드 미입금 ── */
.ob-card-unpaid                 { border-left: 3px solid #e8590c !important; background: #fff4e6; }
.ob-unpaid-badge                { background: #ffe8cc; color: #c05621; font-weight: 700; }

/* ── 셀 스타일 ── */
.sl-date   { color: var(--gray-600); font-size: .78rem; }
.sl-brand  { font-weight: 600; color: var(--text); }
.sl-model  { font-weight: 500; }
.sl-vendor { color: var(--gray-600); font-size: .8rem; }
.sl-avg-price { color: var(--gray-500); }

.sl-spec-tag {
  display: inline-block; font-size: .72rem; background: var(--gray-100);
  color: var(--gray-600); border-radius: 4px; padding: .05rem .35rem;
}
.sl-empty-spec { color: var(--gray-300); }

/* ── 수량 반품 표시 ── */
.sl-qty-reduced { font-weight: 700; color: var(--text); }
.sl-qty-orig    { font-size: .75rem; color: var(--gray-400); text-decoration: line-through; }

/* ── 순수익 색상 ── */
.sl-profit-pos { color: #2f9e44; font-weight: 600; }
.sl-profit-neg { color: #e03131; font-weight: 600; }

/* ── 유형 뱃지 ── */
.sl-type-badge {
  display: inline-block; font-size: .72rem; border-radius: 99px;
  padding: .15rem .5rem; font-weight: 600; white-space: nowrap;
}
.sl-type-normal   { background: #d3f9d8; color: #1b5e20; }
.sl-type-unpaid   { background: #ffe8cc; color: #c05621; }
.sl-type-return   { background: #ffe3e3; color: #c92a2a; }
.sl-type-exchange { background: #fff3cd; color: #856404; }

/* ── 우선등록 뱃지 ── */
.sl-priority-badge {
  display: inline-block; font-size: .75rem; color: #f59f00;
  vertical-align: middle; margin-left: 2px;
}

/* ── 하단 요약 바 ── */
.sl-summary-bar {
  display: flex; align-items: center; gap: 0;
  border: 1px solid var(--gray-200); border-top: none;
  background: var(--gray-50);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: .6rem 1rem; flex-wrap: wrap; gap: .5rem 1.2rem;
}
.sl-sum-item {
  display: flex; flex-direction: column; gap: .1rem; min-width: 80px;
}
.sl-sum-label {
  font-size: .68rem; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .03em;
}
.sl-sum-val {
  font-size: .9rem; font-weight: 700; color: var(--text);
}
.sl-sum-sales { color: #1971c2; }
.sl-sum-gray  { color: var(--gray-600); font-weight: 600; }
.sl-sum-divider {
  width: 1px; background: var(--gray-200); align-self: stretch; margin: 0 .2rem;
}

/* ══ 출고 엑셀 업로드 미리보기 ════════════════════════════════════ */
.ob-excel-inp {
  width: 100%; padding: .2rem .35rem; border: 1px solid var(--gray-300);
  border-radius: 4px; font-size: .78rem; box-sizing: border-box; background: #fff;
}
.ob-excel-inp:focus { outline: none; border-color: var(--primary); background: #f0f4ff; }
.ob-excel-inp.ob-excel-err { border-color: var(--danger,#e03131); background: #fff0f0; }
.ob-excel-num { text-align: right; }
.ob-excel-sel { padding: .15rem .25rem; cursor: pointer; }

.ob-excel-ok   { background: #f0fff4; }
.ob-excel-warn { background: #fffbe6; }
.ob-excel-bad  { background: #fff5f5; }

.ob-excel-badge {
  display: inline-block; font-size: .72rem; font-weight: 700;
  padding: .1rem .45rem; border-radius: 99px; white-space: nowrap;
}
.ob-excel-ok-badge   { background: #d3f9d8; color: #1b5e20; }
.ob-excel-warn-badge { background: #fff3cd; color: #856404; }
.ob-excel-err-badge  { background: #ffe3e3; color: #c92a2a; }

/* ── 뷰어 권한: 매입가·순수익 숨김 ── */
body.viewer-mode .price-col { display: none !important; }


/* ══════════════════════════════════════════════════════════════════════════
   대시보드
══════════════════════════════════════════════════════════════════════════ */
.db-wrap { padding: 1.2rem 1.4rem; max-width: 1400px; }

/* 로딩 */
.db-loading {
  display: flex; align-items: center; justify-content: center;
  gap: .8rem; padding: 4rem 0; color: var(--gray-600); font-size: .9rem;
}
.db-spinner {
  width: 28px; height: 28px; border: 3px solid var(--gray-200);
  border-top-color: var(--primary); border-radius: 50%;
  animation: dbSpin .7s linear infinite;
}
.db-spinner-sm {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--gray-200); border-top-color: var(--primary);
  border-radius: 50%; animation: dbSpin .7s linear infinite; vertical-align: middle;
}
@keyframes dbSpin { to { transform: rotate(360deg); } }

/* 뷰어: editor-only 숨김 */
body.viewer-mode .db-editor-only { display: none !important; }

/* ── ① KPI 카드 ─────────────────────────────────────────────────────────── */
.db-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem; margin-bottom: 1.2rem;
}
.db-kpi-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 1.2rem 1.4rem;
  box-shadow: var(--shadow); position: relative;
}
.db-kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; width: 4px;
  height: 100%; background: var(--primary);
}
.db-kpi-card.db-kpi-sales::before { background: var(--success); }
.db-kpi-label {
  font-size: .75rem; font-weight: 600; color: var(--gray-600);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: .4rem;
}
.db-kpi-value {
  font-size: 1.5rem; font-weight: 700; color: var(--text);
  margin-bottom: .3rem; line-height: 1.3;
  word-break: break-word; overflow-wrap: anywhere;
}
.db-kpi-diff { font-size: .85rem; font-weight: 600; min-height: 1.2em; }
.db-kpi-sub  { font-size: .68rem; color: var(--gray-600); margin-top: .25rem; }

.db-diff-up      { color: var(--success); }
.db-diff-down    { color: var(--danger);  }
.db-diff-neutral { color: var(--gray-600); }

/* ── ② 차트 행 ──────────────────────────────────────────────────────────── */
.db-charts-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1rem; margin-bottom: 1.2rem;
}
.db-chart-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 1.2rem 1.4rem; box-shadow: var(--shadow);
}
.db-chart-title {
  font-size: .82rem; font-weight: 700; color: var(--gray-800);
  margin-bottom: .9rem;
}
.db-chart-wrap { height: 220px; position: relative; }

/* ── ③ 날짜 검색 ────────────────────────────────────────────────────────── */
.db-range-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 1.2rem 1.4rem;
  box-shadow: var(--shadow); margin-bottom: 1.2rem;
}
.db-range-header {
  font-size: .82rem; font-weight: 700; color: var(--gray-800); margin-bottom: .8rem;
}
.db-range-controls {
  display: flex; align-items: center; flex-wrap: wrap; gap: .5rem;
}
.db-range-sep { color: var(--gray-600); font-weight: 500; }
.db-range-loading {
  padding: .8rem; color: var(--gray-600); font-size: .85rem;
}
.db-range-stats-grid {
  display: flex; flex-wrap: wrap; gap: 0;
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  margin-top: .9rem; overflow: hidden;
}
.db-rs-item {
  flex: 1; min-width: 120px; padding: .9rem 1.1rem;
  border-right: 1px solid var(--gray-200);
  display: flex; flex-direction: column; gap: .25rem;
}
.db-rs-item:last-child { border-right: none; }
.db-rs-label { font-size: .7rem; color: var(--gray-600); font-weight: 600; }
.db-rs-val   { font-size: 1rem; font-weight: 700; color: var(--text); word-break: break-word; overflow-wrap: anywhere; }

/* TOP 5 */
.db-top5 { margin-top: 1rem; }
.db-top5-title {
  font-size: .78rem; font-weight: 700; color: var(--gray-600);
  margin-bottom: .5rem; text-transform: uppercase; letter-spacing: .04em;
}
.db-top-row {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .45rem .2rem; border-bottom: 1px solid var(--gray-100);
  font-size: .85rem;
}
.db-top-row:last-child { border-bottom: none; }
.db-top-rank {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.db-top-row:nth-child(1) .db-top-rank { background: #f59f00; }
.db-top-row:nth-child(2) .db-top-rank { background: #868e96; }
.db-top-row:nth-child(3) .db-top-rank { background: #cd7f32; }
.db-top-name { flex: 1; font-weight: 500; word-break: break-word; }
.db-top-name em { font-style: normal; color: var(--gray-600); font-size: .8rem; }
.db-top-qty  { color: var(--gray-600); font-size: .8rem; min-width: 40px; text-align: right; white-space: nowrap; }
.db-top-profit { font-weight: 700; min-width: 80px; text-align: right; word-break: break-word; }

/* ── ④⑤ 하단 행 ────────────────────────────────────────────────────────── */
.db-bottom-row {
  display: grid; grid-template-columns: 340px 1fr;
  gap: 1rem;
}
.db-status-card, .db-activity-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 1.2rem 1.4rem; box-shadow: var(--shadow);
}
.db-card-title {
  font-size: .82rem; font-weight: 700; color: var(--gray-800);
  margin-bottom: .9rem; padding-bottom: .5rem; border-bottom: 1px solid var(--gray-100);
}
.db-status-grid {
  display: flex; flex-direction: column; gap: .1rem;
}
.db-stat-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: .5rem .2rem; border-bottom: 1px solid var(--gray-100);
  font-size: .88rem;
}
.db-stat-item:last-child { border-bottom: none; }
.db-stat-label { color: var(--gray-600); }
.db-stat-val   { font-weight: 700; color: var(--text); }
.db-val-warn   { color: var(--warn) !important; }
.db-val-danger { color: var(--danger) !important; }

/* 활동 */
.db-activity-list { display: flex; flex-direction: column; gap: .1rem; }
.db-act-row {
  display: grid;
  grid-template-columns: 80px 80px 42px 1fr 70px;
  gap: .4rem; align-items: center;
  padding: .5rem .2rem; border-bottom: 1px solid var(--gray-100);
  font-size: .82rem;
}
.db-act-row:last-child { border-bottom: none; }
.db-act-who    { font-weight: 600; color: var(--primary); }
.db-act-menu   { color: var(--gray-700); }
.db-act-action { font-size: .72rem; font-weight: 700; padding: .1rem .35rem;
                 border-radius: 10px; text-align: center; }
.db-act-create { background: #d3f9d8; color: #2f9e44; }
.db-act-update { background: #dbe4ff; color: #3b5bdb; }
.db-act-delete { background: #ffe3e3; color: #e03131; }
.db-act-content { color: var(--gray-700); overflow: hidden; text-overflow: ellipsis;
                  white-space: nowrap; }
.db-act-time   { color: var(--gray-600); font-size: .75rem; text-align: right; }

/* 수익 색상 */
.db-profit-pos { color: var(--success); }
.db-profit-neg { color: var(--danger);  }

/* 반응형 */
@media (max-width: 1200px) {
  .db-kpi-grid     { grid-template-columns: repeat(2, 1fr); }
  .db-bottom-row   { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .db-charts-row   { grid-template-columns: 1fr; }
  .db-kpi-grid     { grid-template-columns: repeat(2, 1fr); }
  .db-act-row      { grid-template-columns: 70px 70px 38px 1fr; }
  .db-act-time     { display: none; }
}
@media (max-width: 500px) {
  .db-kpi-grid     { grid-template-columns: 1fr; }
  .db-range-controls .btn { font-size: .75rem; }
}

/* ══ 매입거래처 유형 탭 ══════════════════════════════════════════ */
.pvendor-type-tabs {
  display: flex; gap: .4rem;
  padding: .5rem 1rem; border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.pvendor-type-btn {
  padding: .3rem .9rem; border-radius: 99px; border: 1px solid var(--gray-300);
  background: white; font-size: .82rem; cursor: pointer; color: var(--gray-700);
  transition: all .15s;
}
.pvendor-type-btn.active {
  background: var(--primary); color: white; border-color: var(--primary); font-weight: 600;
}
.pvendor-type-btn:hover:not(.active) { background: var(--gray-100); }

/* 거래처 유형 배지 */
.pv-type-badge {
  display: inline-block; font-size: .72rem; font-weight: 600;
  padding: .1rem .4rem; border-radius: 99px; white-space: nowrap;
}
.pv-type-individual { background: #fff3bf; color: #e67700; }
.pv-type-company    { background: #dbe4ff; color: #3b5bdb; }

/* 거래처 유형 선택 토글 */
.pv-type-toggle {
  display: flex; gap: 0; border: 1px solid var(--gray-300); border-radius: 6px;
  overflow: hidden; width: fit-content; margin-bottom: .75rem;
}
.pv-type-btn {
  padding: .35rem 1rem; border: none; background: white;
  font-size: .85rem; cursor: pointer; color: var(--gray-700); transition: all .15s;
}
.pv-type-btn:not(:last-child) { border-right: 1px solid var(--gray-300); }
.pv-type-btn.active { background: var(--primary); color: white; font-weight: 600; }
.pv-type-btn:hover:not(.active) { background: var(--gray-100); }

/* ══ 입고 거래처 인라인 검색 ══════════════════════════════════════ */
.ib-vendor-wrap { position: relative; }
.ib-vendor-wrap input { width: 100%; }
.ib-vendor-dd {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: white; border: 1px solid var(--gray-300); border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12); z-index: 200;
  max-height: 260px; overflow-y: auto;
}
.ib-vendor-dd-item {
  padding: .5rem .8rem; cursor: pointer; display: flex; align-items: center; gap: .5rem;
  font-size: .85rem; border-bottom: 1px solid var(--gray-100);
  transition: background .1s;
}
.ib-vendor-dd-item:last-child { border-bottom: none; }
.ib-vendor-dd-item:hover { background: var(--gray-50); }
.ib-vendor-dd-item.dd-new {
  color: var(--primary); font-weight: 600;
  border-top: 1px solid var(--gray-200);
}
.ib-vendor-dd-empty { padding: .6rem .8rem; color: var(--gray-500); font-size: .82rem; }
.ib-vdd-sub { color: var(--gray-500); font-size: .78rem; }

/* ══ 출고 상세 Sticky Footer ══════════════════════════════════════ */
.ob-sticky-footer {
  position: sticky; bottom: 0; left: 0; right: 0;
  background: white; border-top: 2px solid var(--gray-200);
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
  display: flex; align-items: center; justify-content: flex-end;
  gap: 1.5rem; padding: .75rem 1.5rem;
  z-index: 10;
}
.ob-sf-item { display: flex; align-items: center; gap: .4rem; }
.ob-sf-label { font-size: .82rem; color: var(--gray-600); }
.ob-sf-val { font-weight: 700; font-size: .95rem; color: var(--text); }
.ob-sf-sep { color: var(--gray-400); font-size: 1rem; font-weight: 400; }
.ob-sf-total .ob-sf-val { font-size: 1.05rem; color: var(--primary); }

/* ── 휴지통 ── */
.trash-type-badge {
  display: inline-block; padding: .15rem .5rem;
  background: var(--gray-100); border: 1px solid var(--gray-200);
  border-radius: 999px; font-size: .78rem; color: var(--gray-700);
  white-space: nowrap;
}

/* 탭 바 */
.trash-tab-bar {
  display: flex; gap: .35rem; flex-wrap: wrap; margin: .5rem 0 .25rem;
}
.trash-tab-btn {
  padding: .3rem .75rem; font-size: .82rem;
  background: var(--gray-100); border: 1px solid var(--gray-200);
  border-radius: 999px; cursor: pointer; color: var(--gray-600);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.trash-tab-btn:hover  { background: var(--gray-200); }
.trash-tab-btn.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

/* 목록 행 */
.tr-row:hover { background: var(--gray-50); }
.tr-summary-name { font-weight: 600; font-size: .85rem; color: var(--gray-800); }
.tr-summary-sub  { font-size: .78rem; color: var(--gray-500); margin-top: .1rem; }

/* 만료일 표시 */
.tr-expire        { font-size: .8rem; font-weight: 600; }
.tr-expire.danger { color: var(--danger); }
.tr-expire.warn   { color: #f08c00; }
.tr-expire.muted  { color: var(--gray-400); }

/* 상세 팝업 */
.tr-detail-bd     { padding: 1rem; }
.tr-meta-tbl th   { width: 90px; font-weight: 600; color: var(--gray-600); background: var(--gray-50); }
.tr-sep           { border: none; border-top: 1px solid var(--gray-200); margin: .75rem 0; }
.tr-expire-row    { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.tr-items-title   {
  font-size: .82rem; font-weight: 700; color: var(--gray-600);
  margin: .5rem 0 .3rem; padding-bottom: .2rem;
  border-bottom: 1px solid var(--gray-200);
}
.tr-items-tbl th  { font-size: .78rem; padding: .35rem .5rem; background: var(--gray-50); }
.tr-items-tbl td  { font-size: .8rem; padding: .35rem .5rem; }

/* ── 감사로그 ── */
.al-table-badge {
  display: inline-block; padding: .15rem .5rem;
  background: #e8f4fd; border-radius: 999px;
  font-size: .78rem; color: #1971c2; white-space: nowrap;
}
.al-action          { display: inline-block; padding: .1rem .45rem; border-radius: 4px; font-size: .8rem; font-weight: 700; }
.al-act-create      { background: #d3f9d8; color: #2f9e44; }
.al-act-update      { background: #fff3bf; color: #e67700; }
.al-act-delete      { background: #ffe3e3; color: #c92a2a; }
.al-pre {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: 6px; padding: .6rem .75rem;
  font-size: .75rem; line-height: 1.5;
  overflow: auto; max-height: 260px; white-space: pre-wrap; word-break: break-all;
}
