/* ============================================
   StockOps - 재고운영 시스템 메인 스타일
   ============================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #64748b;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #0891b2;
  --info-bg: #ecfeff;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #2563eb;
  --sidebar-hover: #1e293b;
  --sidebar-width: 240px;
  --topbar-height: 60px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

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

html, body {
  font-family: 'Noto Sans KR', -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  height: 100%;
  overflow-x: hidden;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.page-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  padding: 20px;
}

.login-container {
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 64px; height: 64px;
  background: var(--primary);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px; color: white;
}
.login-logo h1 { font-size: 24px; font-weight: 700; color: var(--text-primary); }
.login-logo p { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }

.login-form { display: flex; flex-direction: column; gap: 16px; }
.form-group label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; color: var(--text-secondary); }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; }
.input-icon input {
  width: 100%; padding: 10px 12px 10px 36px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: 14px; color: var(--text-primary);
  transition: border-color 0.2s;
  outline: none;
}
.input-icon input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.login-hint {
  background: var(--bg); border-radius: var(--radius);
  padding: 10px 14px; color: var(--text-secondary); font-size: 12px; line-height: 1.7;
}

.btn-login {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px; background: var(--primary);
  color: white; border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: background 0.2s;
}
.btn-login:hover { background: var(--primary-dark); }

.login-error {
  background: var(--danger-bg); color: var(--danger); border-radius: var(--radius);
  padding: 10px 14px; font-size: 13px; text-align: center;
}

/* ============================================
   APP LAYOUT
   ============================================ */
.app-layout {
  display: flex; height: 100vh; overflow: hidden;
}

/* ============================================
   SIDEBAR – 아코디언 네비게이션
   ============================================ */
.sidebar {
  width: var(--sidebar-width); height: 100vh;
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column;
  flex-shrink: 0; transition: width 0.22s ease; overflow: hidden;
  z-index: 100;
}

/* 접힘 상태 */
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .sidebar-logo span,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-group-body,
.sidebar.collapsed .nav-group-label span,
.sidebar.collapsed .nav-group-arrow,
.sidebar.collapsed .nav-group-badge-coming,
.sidebar.collapsed .nav-item-home span,
.sidebar.collapsed .sidebar-footer span { display: none; }
.sidebar.collapsed .sidebar-logo { justify-content: center; }
.sidebar.collapsed .sidebar-user { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-group-header { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-group-label { justify-content: center; }
.sidebar.collapsed .nav-group-icon { margin: 0; }
.sidebar.collapsed .nav-item-home { justify-content: center; padding: 12px; }
/* collapsed 시 헤더: 토글 버튼만 중앙 표시 */
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 10px 8px; }
.sidebar.collapsed .sidebar-logo { display: none; }
/* collapsed 토글 버튼 강조 */
.sidebar.collapsed .sidebar-toggle {
  background: rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar.collapsed .sidebar-toggle:hover {
  background: rgba(255,255,255,0.25);
}
/* 접힌 상태에서 아이콘 회전 (▶ 방향 표시) */
.sidebar.collapsed .sidebar-toggle i {
  transform: rotate(180deg);
  transition: transform 0.22s ease;
}
/* 펼쳐진 상태 아이콘 (초기) */
.sidebar:not(.collapsed) .sidebar-toggle i {
  transform: rotate(0deg);
  transition: transform 0.22s ease;
}

/* 헤더 */
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-logo i { font-size: 22px; color: var(--primary); flex-shrink: 0; }
.sidebar-logo span { font-size: 17px; font-weight: 700; color: white; white-space: nowrap; }
/* 로고 링크 hover 효과 */
a.sidebar-logo {
  border-radius: 6px; padding: 4px 6px; margin: -4px -6px;
  transition: background 0.18s, opacity 0.18s;
  text-decoration: none;
}
a.sidebar-logo:hover { background: rgba(255,255,255,0.12); opacity: 0.92; }
.sidebar-toggle {
  background: none; border: none; color: var(--sidebar-text);
  cursor: pointer; padding: 4px; border-radius: 4px;
  transition: background 0.2s; flex-shrink: 0;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.1); }

/* 사용자 */
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; color: white; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* 네비게이션 스크롤 영역 */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 0 8px; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* 홈 단일 메뉴 아이템 */
.nav-item-home {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; margin: 4px 8px;
  color: var(--sidebar-text); text-decoration: none;
  border-radius: 8px; transition: all 0.15s;
  white-space: nowrap; font-size: 13px; font-weight: 500;
}
.nav-item-home i { font-size: 15px; flex-shrink: 0; width: 18px; text-align: center; }
.nav-item-home:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item-home.active { background: rgba(37,99,235,0.3); color: white; }

/* ── 대목차 그룹 ── */
.nav-group {
  margin: 3px 8px;
}

/* 대목차 헤더 (클릭하면 열림/닫힘) */
.nav-group-header {
  display: flex; align-items: center; gap: 0;
  padding: 9px 10px; border-radius: 8px;
  cursor: pointer; transition: background 0.15s;
  user-select: none;
}
.nav-group-header:hover { background: rgba(255,255,255,0.07); }

/* 대목차 활성 상태 (해당 그룹 내 페이지 사용 중) */
.nav-group.group-active > .nav-group-header { background: rgba(255,255,255,0.05); }

/* 아이콘 + 레이블 래퍼 */
.nav-group-label {
  display: flex; align-items: center; gap: 9px; flex: 1;
}
.nav-group-icon {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.nav-group-label > span {
  font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap;
}

/* 준비중 뱃지 */
.nav-group-badge-coming {
  font-size: 9px; font-weight: 600;
  background: rgba(148,163,184,0.25); color: #94a3b8;
  padding: 2px 6px; border-radius: 10px; white-space: nowrap;
  margin-right: 4px;
}

/* 화살표 */
.nav-group-arrow {
  font-size: 10px; color: #64748b;
  transition: transform 0.22s ease; flex-shrink: 0;
  margin-left: 4px;
}
.nav-group.open > .nav-group-header .nav-group-arrow {
  transform: rotate(-180deg);
}

/* 서브 메뉴 본문 (애니메이션) */
.nav-group-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.28s ease, opacity 0.22s ease;
  opacity: 0;
}
.nav-group.open > .nav-group-body {
  max-height: 600px;
  opacity: 1;
}

/* 서브 메뉴 아이템 */
.nav-item.nav-sub {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px 8px 14px;
  margin: 1px 0;
  color: #94a3b8; text-decoration: none;
  border-radius: 6px; font-size: 12.5px;
  transition: all 0.12s; white-space: nowrap;
  border-left: none;
}
.nav-item.nav-sub i { font-size: 13px; flex-shrink: 0; width: 16px; text-align: center; }
.nav-item.nav-sub:hover { background: rgba(255,255,255,0.07); color: #e2e8f0; }
.nav-item.nav-sub.active {
  background: rgba(37,99,235,0.25); color: white;
  border-left: 2px solid var(--primary);
  padding-left: 12px;
}

/* 소목차(2단계 레이블) */
.nav-sub-section {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: #475569; padding: 8px 14px 3px;
  white-space: nowrap;
}

/* 소목차 들여쓰기 */
.nav-sub-indent { padding-left: 22px !important; }

/* 준비중 서브 메뉴 */
.nav-item.nav-coming { opacity: 0.5; pointer-events: none; cursor: not-allowed; }
.nav-item.nav-coming:hover { background: none; }

/* 예정 뱃지 */
.nav-badge-soon {
  margin-left: auto; font-size: 9px; font-weight: 600;
  background: rgba(148,163,184,0.2); color: #64748b;
  padding: 1px 5px; border-radius: 8px; white-space: nowrap;
}

/* 풋터 */
.sidebar-footer {
  padding: 10px 8px; border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.btn-logout {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 12px; background: none; border: none;
  color: var(--text-muted); cursor: pointer; border-radius: 8px;
  font-family: inherit; font-size: 13px; transition: all 0.15s; white-space: nowrap;
}
.btn-logout:hover { background: rgba(220,38,38,0.15); color: #f87171; }

/* 구분선 */
.nav-divider {
  height: 1px; background: rgba(255,255,255,0.06);
  margin: 6px 16px;
}

/* MAIN CONTENT */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  height: var(--topbar-height); background: white;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; gap: 12px; flex-shrink: 0;
  box-shadow: var(--shadow);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-menu-btn {
  background: none; border: none; cursor: pointer;
  padding: 6px 8px; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 16px;
  transition: background 0.18s, color 0.18s;
}
.topbar-menu-btn:hover { background: var(--border); color: var(--text-primary); }
/* collapsed 상태일 때 topbar 버튼 강조 */
body.sidebar-collapsed .topbar-menu-btn {
  background: #e0f2fe; color: #0369a1;
}
body.sidebar-collapsed .topbar-menu-btn:hover {
  background: #bae6fd; color: #0c4a6e;
}

/* 브레드크럼 */
.breadcrumb { display: flex; align-items: center; gap: 6px; }
.bc-module {
  font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 6px;
  white-space: nowrap;
}
.bc-sep { font-size: 9px; color: var(--text-muted); }
.page-title { font-size: 16px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-date { font-size: 13px; color: var(--text-muted); }
.topbar-user-info { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }

.badge-role {
  padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-role.admin { background: #fef3c7; color: #92400e; }
.badge-role.editor { background: #dbeafe; color: #1e40af; }
.badge-role.viewer { background: #dcfce7; color: #166534; }

.content-area {
  flex: 1; overflow-y: auto; padding: 20px; padding-bottom: 60px;
}

/* ============================================
   CARDS & LAYOUT
   ============================================ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-header h3 { font-size: 18px; font-weight: 600; }

.card {
  background: white; border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 20px;
  box-shadow: var(--shadow);
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--text-primary); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 20px;
}

.stat-card {
  background: white; border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 18px 20px;
  box-shadow: var(--shadow); display: flex; align-items: flex-start; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.stat-icon.blue { background: #eff6ff; color: var(--primary); }
.stat-icon.green { background: #f0fdf4; color: var(--success); }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.purple { background: #faf5ff; color: #7c3aed; }
.stat-icon.red { background: #fef2f2; color: var(--danger); }
.stat-icon.cyan { background: #ecfeff; color: var(--info); }

.stat-content { min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.stat-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ============================================
   TABLE STYLES
   ============================================ */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
thead { position: sticky; top: 0; z-index: 1; }
thead th {
  background: var(--border-light); color: var(--text-secondary);
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 10px 14px;
  border-bottom: 2px solid var(--border); white-space: nowrap;
  text-align: left;
}
tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
tbody tr:hover { background: #f8fafc; }
tbody td {
  padding: 11px 14px; font-size: 13px; color: var(--text-primary);
}
tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody td.center { text-align: center; }

.table-empty {
  text-align: center; padding: 48px 20px;
  color: var(--text-muted); font-size: 14px;
}
.table-empty i { font-size: 36px; display: block; margin-bottom: 12px; opacity: 0.5; }

/* ============================================
   FORMS & INPUTS
   ============================================ */
.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.form-group-inline { flex: 1; min-width: 160px; }
.form-group-inline label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }

input[type="text"], input[type="number"], input[type="date"], input[type="password"],
select, textarea {
  width: 100%; padding: 8px 10px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: 13px; color: var(--text-primary);
  background: white; outline: none; transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}
select { cursor: pointer; }
textarea { resize: vertical; min-height: 80px; }

.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: white; border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 7px 12px; flex: 1; max-width: 360px;
  transition: border-color 0.2s;
}
.search-bar:focus-within { border-color: var(--primary); }
.search-bar i { color: var(--text-muted); font-size: 14px; }
.search-bar input { border: none; outline: none; font-size: 14px; background: none; flex: 1; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; transition: all 0.15s; white-space: nowrap;
  text-decoration: none;
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 14px; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: white; color: var(--text-secondary); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--bg); border-color: var(--secondary); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #b45309; }
.btn-ghost { background: none; color: var(--text-secondary); border: 1.5px solid transparent; }
.btn-ghost:hover { background: var(--border-light); color: var(--text-primary); }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================
   BADGES & TAGS
   ============================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-purple { background: #f3e8ff; color: #6b21a8; }
.badge-yellow { background: #fef9c3; color: #713f12; }
.badge-cyan { background: #cffafe; color: #155e75; }
.badge-teal { background: #e0f2fe; color: #0c4a6e; }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 1000; backdrop-filter: blur(2px);
}
.modal-container {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: white; border-radius: var(--radius-lg);
  width: 95%; max-width: 640px; max-height: 92vh;
  display: flex; flex-direction: column; z-index: 1001;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--text-muted); border-radius: 4px;
  font-size: 16px; transition: all 0.15s;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { padding: 20px; overflow-y: auto; overflow-x: hidden; flex: 1; }
.modal-footer {
  padding: 12px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px; z-index: 2000;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius);
  background: #1e293b; color: white; font-size: 13px;
  box-shadow: var(--shadow-lg); min-width: 260px; max-width: 380px;
  animation: slideInRight 0.3s ease;
}
.toast.success { background: #166534; }
.toast.error { background: #991b1b; }
.toast.warning { background: #92400e; }
.toast i { font-size: 15px; flex-shrink: 0; }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   INVENTORY STOCK SPECIFIC
   ============================================ */
.stock-number { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.stock-ok { color: var(--success); }
.stock-warn { color: var(--warning); }
.stock-zero { color: var(--danger); }
.stock-sub { font-size: 12px; color: var(--text-secondary); font-weight: 400; }

.stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.stock-card {
  background: white; border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 16px 18px;
  box-shadow: var(--shadow); transition: box-shadow 0.2s;
}
.stock-card:hover { box-shadow: var(--shadow-md); }
.stock-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 12px;
}
.stock-card-code { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.stock-card-name { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-top: 2px; }
.stock-card-values { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.stock-card-val { text-align: center; }
.stock-card-val .label { font-size: 10px; color: var(--text-muted); margin-bottom: 2px; }
.stock-card-val .value { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.stock-card-val .unit { font-size: 10px; color: var(--text-secondary); }

/* Event type badge */
.event-IN { background: #dbeafe; color: #1e40af; }
.event-PRODUCTION { background: #dcfce7; color: #166534; }
.event-SALE { background: #fee2e2; color: #991b1b; }
.event-ASSEMBLY_IN { background: #ffedd5; color: #9a3412; }
.event-ASSEMBLY_OUT { background: #f3e8ff; color: #6b21a8; }
.event-ADJUST { background: #fef9c3; color: #713f12; }
.event-RETURN { background: #cffafe; color: #155e75; }
.event-ETC { background: #f1f5f9; color: #475569; }

/* ============================================
   CHART CONTAINER
   ============================================ */
.chart-container { position: relative; height: 280px; }
.chart-container-lg { position: relative; height: 360px; }

/* ============================================
   FILTER TOOLBAR
   ============================================ */
.filter-toolbar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 16px;
}

/* ============================================
   TABS
   ============================================ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); background: none; border: none;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.15s;
  font-family: inherit;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ============================================
   BOM TABLE
   ============================================ */
.bom-component-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--bg);
  border-radius: var(--radius); margin-bottom: 6px;
}
.bom-component-row .comp-badge { width: 70px; text-align: center; flex-shrink: 0; }
.bom-component-row .comp-name { flex: 1; font-weight: 500; font-size: 13px; }
.bom-component-row .comp-qty { font-size: 16px; font-weight: 700; color: var(--primary); min-width: 50px; text-align: center; }

/* ============================================
   UPLOAD SECTION
   ============================================ */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: all 0.2s; background: var(--bg);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary); background: var(--primary-light);
}
.upload-zone i { font-size: 36px; color: var(--text-muted); margin-bottom: 12px; display: block; }
.upload-zone p { color: var(--text-secondary); margin-bottom: 8px; }
.upload-zone small { color: var(--text-muted); }

.upload-step {
  display: flex; align-items: flex-start; gap: 16px; padding: 16px;
  border-radius: var(--radius); background: white; border: 1px solid var(--border);
  margin-bottom: 12px;
}
.upload-step-num {
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.upload-step-num.done { background: var(--success); }
.upload-step-content h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.upload-step-content p { font-size: 13px; color: var(--text-secondary); }

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */
@media (max-width: 900px) {
  .sidebar { 
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%); transition: transform 0.25s ease;
    z-index: 200; width: var(--sidebar-width) !important;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed { transform: translateX(-100%); }
  /* 모바일에서 collapsed 숨김 해제 */
  .sidebar.collapsed .nav-group-body,
  .sidebar.collapsed .nav-group-label span,
  .sidebar.collapsed .nav-group-arrow,
  .sidebar.collapsed .nav-group-badge-coming,
  .sidebar.collapsed .nav-item-home span { display: flex; }
  .sidebar.collapsed .nav-group-header { padding: 9px 10px; justify-content: flex-start; }
  .sidebar.collapsed .nav-item-home { padding: 10px 16px; justify-content: flex-start; }
  .topbar-menu-btn { /* 모바일 이미 flex — 유지 */ }
  .main-content { width: 100%; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; }
  .content-area { padding: 10px; }
  .bc-module { display: none; }
  .bc-sep { display: none !important; }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stock-grid { grid-template-columns: 1fr; }
  .topbar-date { display: none; }
  .login-container { padding: 28px 20px; }
  /* 기본 테이블 가로 스크롤 — 재고실사/재고현황은 별도 처리 */
  .table-scroll-wrap table { min-width: 500px; }
}

/* ============================================
   UTILITIES
   ============================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.loading-spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 스켈레톤 로딩 UI ── */
@keyframes skeleton-wave {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.4s infinite;
  border-radius: 6px;
}

/* ============================================
   PRODUCTION TOUCH UI
   ============================================ */
.prod-touch-wrap {
  max-width: 1000px; margin: 0 auto; padding: 0 4px;
}
.prod-touch-header {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 20px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.prod-touch-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700; color: var(--text-primary);
}
.prod-touch-date { font-size: 13px; color: var(--text-muted); font-weight: 500; }

/* 선택 그리드 */
.prod-select-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 700px) { .prod-select-grid { grid-template-columns: 1fr; } }

.prod-select-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow);
}
.prod-select-label {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; background: var(--bg);
  font-size: 14px; font-weight: 700; border-bottom: 1px solid var(--border);
}
.prod-step-num {
  width: 22px; height: 22px; border-radius: 50%; background: var(--primary);
  color: white; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.prod-select-body {
  padding: 12px; display: flex; flex-direction: column; gap: 6px;
  max-height: 240px; overflow-y: auto;
}
.prod-sel-btn {
  width: 100%; text-align: left; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text-primary);
  font-size: 14px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: all 0.15s;
}
.prod-sel-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.prod-sel-btn.selected {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary); font-weight: 700;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}
.prod-sel-code { font-size: 11px; background: #e2e8f0; color: #475569; padding: 1px 6px; border-radius: 4px; }
.prod-sel-dept { font-size: 11px; color: var(--text-muted); margin-left: auto; }

/* ============================================
   공통 — 품목명/규격명 표시 유틸 (v20260507b)
   .ops-item-cell: 품목명과 규격명을 동일 크기로 표시
   .ops-item-name: 품목명
   .ops-item-spec: 규격명 (말줄임 적용)
   ============================================ */
.ops-item-cell {
  display: flex;
  align-items: baseline;
  gap: 0;
  max-width: 100%;
  overflow: hidden;
}
.ops-item-name {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}
.ops-item-spec {
  color: var(--text-secondary);
  margin-left: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
/* 블록 배치 (줄바꿈) */
.ops-item-cell.block {
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.ops-item-cell.block .ops-item-spec {
  margin-left: 0;
  font-size: 0.9em;
}

/* 전화번호 표시 — 하이픈 분리 방지 */
.ops-phone {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* 선택 요약 바 */
.prod-summary-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 20px;
  box-shadow: var(--shadow); flex-wrap: wrap;
}
.prod-summary-items { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.prod-summary-item { display: flex; align-items: center; gap: 6px; font-size: 14px; padding: 6px 12px; background: var(--bg); border-radius: 8px; border: 1px solid var(--border); }
.prod-summary-sep { color: var(--text-muted); font-size: 16px; }

/* START 버튼 */
.prod-start-btn {
  padding: 14px 36px; background: #16a34a; color: white;
  border: none; border-radius: 12px; font-size: 18px; font-weight: 800;
  cursor: pointer; display: flex; align-items: center; gap: 10px;
  transition: all 0.15s; box-shadow: 0 4px 12px rgba(22,163,74,0.3);
  letter-spacing: 0.04em; min-width: 140px; justify-content: center;
}
.prod-start-btn:hover:not([disabled]) { background: #15803d; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(22,163,74,0.4); }
.prod-start-btn[disabled] { background: #94a3b8; box-shadow: none; cursor: not-allowed; opacity: 0.6; }

/* 작업 진행 중 */
.prod-running-wrap .prod-touch-header.prod-header-running {
  background: linear-gradient(135deg, #065f46, #16a34a);
  border-color: transparent;
}
.prod-running-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.2); color: white;
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  animation: pulseGreen 1.5s ease-in-out infinite;
}
@keyframes pulseGreen { 0%,100%{opacity:1} 50%{opacity:0.7} }

.prod-elapsed-wrap {
  text-align: center; padding: 30px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.prod-elapsed-label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.prod-elapsed-time {
  font-size: 56px; font-weight: 800; color: #16a34a;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  line-height: 1;
}
.prod-elapsed-since { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

.prod-info-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 600px) { .prod-info-cards { grid-template-columns: 1fr; } }

.prod-info-card {
  padding: 16px; border-radius: 12px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.prod-info-card > i { font-size: 22px; }
.prod-info-card.blue { background: #dbeafe; color: #1e40af; }
.prod-info-card.orange { background: #ffedd5; color: #9a3412; }
.prod-info-card.green { background: #dcfce7; color: #166534; }
.prod-info-label { font-size: 11px; font-weight: 600; opacity: 0.7; }
.prod-info-val { font-size: 15px; font-weight: 700; }

/* END 버튼 */
.prod-end-btn {
  padding: 16px 48px; background: #dc2626; color: white;
  border: none; border-radius: 12px; font-size: 20px; font-weight: 800;
  cursor: pointer; display: flex; align-items: center; gap: 10px;
  transition: all 0.15s; box-shadow: 0 4px 12px rgba(220,38,38,0.3);
  letter-spacing: 0.04em;
}
.prod-end-btn:hover { background: #b91c1c; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(220,38,38,0.4); }

/* END 입력 모달 */
.prod-end-modal { display: flex; flex-direction: column; gap: 16px; }
.prod-end-section { display: flex; flex-direction: column; gap: 8px; }
.prod-end-label { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }

.prod-qty-display {
  font-size: 40px; font-weight: 800; text-align: center;
  padding: 12px; background: #f0fdf4; border: 2px solid #bbf7d0;
  border-radius: 10px; color: #16a34a; font-variant-numeric: tabular-nums;
}
.prod-qty-display.prod-qty-defect { background: #fef2f2; border-color: #fecaca; color: #dc2626; }

.prod-numpad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.prod-num-key {
  padding: 12px 0; border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--surface); font-size: 18px; font-weight: 700;
  cursor: pointer; transition: all 0.1s; color: var(--text-primary);
  touch-action: manipulation;
}
.prod-num-key:hover, .prod-num-key:active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.prod-num-clear { color: var(--danger); border-color: #fecaca; background: #fef2f2; }
.prod-num-back  { color: var(--warning); border-color: #fde68a; background: #fffbeb; }

.prod-end-preview {
  display: flex; gap: 16px; padding: 12px 16px;
  background: var(--bg); border-radius: 8px; border: 1px solid var(--border);
  font-size: 13px; flex-wrap: wrap;
}

/* 생산 마스터 탭 */
.prod-master-tab {
  padding: 8px 16px; border: none; background: none;
  font-size: 13px; font-weight: 500; cursor: pointer;
  border-radius: 6px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px; transition: all 0.15s;
}
.prod-master-tab.active { background: var(--primary); color: white; font-weight: 600; }
.prod-master-tab:hover:not(.active) { background: var(--border); }
.prod-master-content { }

/* form-control 공통 */
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--surface); color: var(--text-primary);
  transition: border 0.15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

/* btn-xs */
.btn-xs { padding: 3px 8px !important; font-size: 11px !important; }
.btn-lg { padding: 12px 28px !important; font-size: 15px !important; }

/* input-icon wrapper */
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > i { position: absolute; left: 10px; color: var(--text-muted); font-size: 13px; pointer-events: none; }
.input-icon > input { padding-left: 32px; }


.highlight { background: #fef08a; border-radius: 2px; padding: 0 2px; }
.mobile-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 150;
}
@media (max-width: 900px) {
  .mobile-overlay.show { display: block; }
}

/* ============================================
   AS 통합 UI - 추가 스타일
   ============================================ */

/* 정보 블록 (상세 보기 그리드 셀) */
.info-block {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.info-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.info-value {
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-word;
}

/* KPI 카드 (AS 집계) */
.kpi-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}
.kpi-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.kpi-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 링크 텍스트 스타일 */
.link-text {
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
}
.link-text:hover {
  text-decoration: underline;
}

/* 배지 크기 변형 */
.badge-sm {
  font-size: 10px;
  padding: 1px 6px;
}
.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

/* 호버 테이블 행 */
.hover-row:hover {
  background: var(--primary-light);
  transition: background 0.1s;
}

/* AS 연결 배지 */
.as-conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 500;
}
.as-conn-badge.connected {
  background: #dcfce7;
  color: #166534;
}
.as-conn-badge.disconnected {
  background: #fee2e2;
  color: #991b1b;
}

/* 버튼 크기 sm */
.btn-sm {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
}

/* 폼 컨트롤 개선 */
.form-control {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color 0.15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* 모달 크기 확장 */
.modal-container {
  max-width: 780px;
  width: 95vw;
  max-height: 92vh;
}

/* ── AS 접수 팝업 내부 form-row: 태블릿에서도 가로 유지 ── */
/* 전역 .form-row는 900px 미만에서 세로로 변환되지만
   .modal-body 안의 form-row는 팝업 내부 공간이 충분하므로 가로 유지 */
.modal-body .form-row {
  flex-direction: row !important;
  flex-wrap: wrap;
}
.modal-body .form-row > * {
  min-width: 140px;
}

/* AS 팝업 2열 그리드 → 태블릿 이하(960px)에서 1열 전환 */
@media (max-width: 960px) {
  .as-form-grid {
    grid-template-columns: 1fr !important;
  }
}

/* 반응형: AS 페이지 그리드 */
@media (max-width: 768px) {
  .kpi-card { padding: 14px; }
  .kpi-value { font-size: 24px; }
}
@media (max-width: 520px) {
  .modal-container { max-width: 100vw; border-radius: 0; top: 0; left: 0; transform: none; width: 100%; max-height: 100vh; }
  .modal-body .form-row { flex-direction: column !important; }
  .modal-body .form-row > * { min-width: unset; }
}

/* ============================================
   재고실사 (warehouse-count) 모바일 반응형
   ============================================ */

/* 품목 카드 입력 섹션: 팔릿모드 3열 → 모바일 1열 */
.wc-item-inputs {
  display: grid;
  gap: 6px;
}
.wc-item-inputs.lot-mode   { grid-template-columns: 1fr 160px; }
.wc-item-inputs.pallet-mode { grid-template-columns: 1fr 1fr 160px; }

@media (max-width: 640px) {
  .wc-item-inputs.lot-mode,
  .wc-item-inputs.pallet-mode {
    grid-template-columns: 1fr !important;
  }
  /* 보정 칸은 모바일에서 가로 2등분 */
  .wc-correction-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px;
  }
}

/* 로트 행: PC = 7칸 그리드 / 모바일 = 2행 flex 구조 */
.wc-lot-row-header,
.wc-lot-row {
  display: grid;
  grid-template-columns: 100px 52px 48px 48px 48px 48px 26px;
  gap: 3px;
  padding: 0 2px;
}

/* ── 모바일 로트 행: 2행 레이아웃으로 전환 ── */
@media (max-width: 640px) {
  /* 헤더 숨김 */
  .wc-lot-row-header { display: none !important; }

  /* 행 전체를 flex 컨테이너로 전환 → 아이템이 줄바꿈 */
  .wc-lot-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    padding: 4px;
  }

  /* 로트번호 input: 1행 전체 너비 */
  .wc-lot-row > input[data-lot-field="lotNo"] {
    flex: 1 1 100%;
    min-width: 0;
    font-size: 13px !important;
  }

  /* 숫자 입력 5개(박스입수·박스수·낱개·별도·불량): 2행에 균등 배치 */
  .wc-lot-row > input[data-lot-field="boxQty"],
  .wc-lot-row > input[data-lot-field="boxCount"],
  .wc-lot-row > input[data-lot-field="unitCount"],
  .wc-lot-row > input[data-lot-field="extraCount"],
  .wc-lot-row > input[data-lot-field="defCount"] {
    flex: 1 1 0;
    min-width: 42px;
    max-width: 72px;
    padding: 6px 2px !important;
    font-size: 14px !important;
  }

  /* 삭제 버튼 */
  .wc-lot-row > div:last-child {
    flex: 0 0 auto;
  }
}

@media (max-width: 380px) {
  .wc-lot-row > input[data-lot-field="boxQty"],
  .wc-lot-row > input[data-lot-field="boxCount"],
  .wc-lot-row > input[data-lot-field="unitCount"],
  .wc-lot-row > input[data-lot-field="extraCount"],
  .wc-lot-row > input[data-lot-field="defCount"] {
    min-width: 36px;
    font-size: 13px !important;
  }
}

/* 품목 상단 행(ID+이름+뱃지들+수량표시) — 모바일에서 세로 배치 */
.wc-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
  flex-wrap: wrap;
}
.wc-item-qty-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .wc-item-qty-row {
    width: 100%;
    justify-content: flex-end;
  }
}

/* 세션 헤더 툴바 — 모바일에서 줄바꿈 */
.wc-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .wc-toolbar { gap: 6px; }
  .wc-toolbar .btn { font-size: 12px; padding: 5px 10px; }
}

/* 전일재고/당일출고/예상재고 바 — 모바일에서 2열 */
.wc-info-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.wc-info-bar > div { flex: 1; min-width: 72px; }
@media (max-width: 400px) {
  .wc-info-bar > div { min-width: 60px; }
}

/* ============================================
   제품별 재고현황 (product-stock) 모바일 반응형
   ============================================ */

/* 날짜 선택 바 */
.ps-date-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .ps-date-bar { gap: 7px; }
  .ps-date-bar input[type="date"] { font-size: 12px; padding: 4px 7px; }
}

/* 그룹 헤더: ERP/실사/차이 수량 → 모바일에서 줄바꿈 */
.ps-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  flex-wrap: wrap;
}
.ps-group-qty-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
@media (max-width: 480px) {
  .ps-group-qty-row { gap: 6px; }
  .ps-group-qty-row > div > div:last-child { font-size: 15px !important; }
}

/* 품목 그리드: auto-fill 120px → 모바일 3열 */
.ps-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
}
@media (max-width: 480px) {
  .ps-item-grid { grid-template-columns: repeat(3, 1fr); gap: 5px; }
}
@media (max-width: 360px) {
  .ps-item-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 데이터 소스 현황 바 (ERP/실사 뱃지들) */
.ps-source-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
@media (max-width: 480px) {
  .ps-source-bar { gap: 5px; }
  .ps-source-bar > div { font-size: 11px; }
}

/* 탭 버튼 → 모바일에서 작게 */
@media (max-width: 480px) {
  .ps-tab-btn { font-size: 12px !important; padding: 7px 12px !important; }
}
