/* =====================================================
   BASE
===================================================== */
:root {
  font-family: -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Noto Sans KR",
               "Apple SD Gothic Neo", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 16px;
  background: #0f1115;
  color: #e6e6e6;
}

a { color: #8ab4ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* =====================================================
   LAYOUT
===================================================== */
.container { max-width: 980px; margin: 0 auto; }

.grid, .grid2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

/* =====================================================
   HEADER (MAIN)
===================================================== */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.header-bar h1 { margin: 0; font-size: 22px; }

/* 로그아웃 버튼 */
.logout-btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #2a2f3a;
  background: #171a21;
  color: #e6e6e6;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.logout-btn:hover {
  background: #ff6b6b;
  border-color: #ff6b6b;
  color: #0f1115;
  text-decoration: none;
}

/* =====================================================
   CARD
===================================================== */
.card {
  background: #171a21;
  border: 1px solid #2a2f3a;
  border-radius: 14px;
  padding: 16px;
  margin: 12px 0;
}

.card h1, .card h2 { margin: 0 0 12px 0; }

.card.highlight,
.menu-btn.highlight {
  border: 2px solid #ff6b6b;
  color: #ff6b6b;
  font-weight: 700;
}

/* =====================================================
   MENU BUTTONS
===================================================== */
.menu-btn {
  display: block;
  background: #171a21;
  border: 1px solid #2a2f3a;
  border-radius: 14px;
  padding: 14px;
  margin: 8px 0;
  text-align: center;
  font-weight: 700;
  color: #e6e6e6;
}

.menu-btn:hover { filter: brightness(1.1); text-decoration: none; }

.menu-grid .card { cursor: pointer; text-align: center; }
.menu-grid .card:hover { filter: brightness(1.08); }

/* =====================================================
   FORM
===================================================== */
label {
  display: block;
  margin: 10px 0 6px;
  font-size: 14px;
  color: #b9c0cf;
}

input, textarea, select {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #2a2f3a;
  background: #0f1115;
  color: #e6e6e6;
  font-size: 14px;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

/* =====================================================
   BUTTON
===================================================== */
button {
  margin-top: 14px;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #2a2f3a;
  background: #202736;
  color: #e6e6e6;
  cursor: pointer;
  font-weight: 700;
}
button:hover { filter: brightness(1.08); }

/* =====================================================
   TABLE (BASE)
===================================================== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 14px;
}

th, td {
  border-bottom: 1px solid #2a2f3a;
  padding: 10px 8px;
  vertical-align: top;
}

th {
  text-align: left;
  color: #b9c0cf;
  font-weight: 700;
}

/* =====================================================
   TEXT
===================================================== */
.small {
  font-size: 12px;
  color: #9aa3b5;
  line-height: 1.5;
}

/* =====================================================
   LOGIN PAGE
===================================================== */
.login-box {
  width: 100%;
  max-width: 360px;
  background: #171a21;
  border: 1px solid #2a2f3a;
  border-radius: 16px;
  padding: 24px;
  margin: 0 auto;
}
.login-box h1 { text-align: center; margin-bottom: 20px; }

/* =====================================================
   ✅ HISTORY UI UPGRADE (PC+MOBILE)
   - 테이블 가독성 / 고정헤더 / 스크롤 / 배지 / 수량강조
===================================================== */

/* 이력 테이블 컨테이너(가로 스크롤 + 고정헤더 대비) */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid #2a2f3a;
  background: #12151c;
}

/* 테이블을 wrap 안에서 꽉 차게 */
.table-wrap table {
  margin-top: 0;
  min-width: 980px;          /* 🔥 컬럼 많은 페이지 가로 유지 */
  border-collapse: separate; /* sticky header 더 안정적 */
  border-spacing: 0;
  font-size: 13px;
}

/* 고정 헤더 */
.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #12151c;
  border-bottom: 1px solid #2a2f3a;
}

/* 줄간격/가독성 */
.table-wrap td, .table-wrap th {
  padding: 10px 10px;
  white-space: nowrap; /* 기본은 줄바꿈 방지 */
}

/* 품명 같은 긴 텍스트는 줄바꿈 허용 */
.table-wrap td.wrap {
  white-space: normal;
  line-height: 1.35;
  min-width: 220px;
}

/* hover 강조 */
.table-wrap tbody tr:hover {
  background: rgba(138, 180, 255, 0.06);
}

/* 행 구분 더 깔끔하게 */
.table-wrap tbody td {
  border-bottom: 1px solid rgba(42, 47, 58, 0.7);
}

/* 시간(모노스페이스) */
td.time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #b9c0cf;
}

/* FROM → TO */
td.loc {
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* LOT / 규격 모노스페이스 */
td.lot, td.spec {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

/* 브랜드/품번/품명 묶음 */
td.item {
  white-space: normal;
  min-width: 220px;
}
td.item .brand { font-size: 12px; color: #9aa3b5; }
td.item .code  { font-weight: 800; margin-top: 2px; }
td.item .name  { font-size: 13px; margin-top: 2px; color: #e6e6e6; }

/* 유형 배지 */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.12);
}

.badge.inbound  { background: rgba(39, 174, 96, 0.18);  color: #7dffb2; }
.badge.outbound { background: rgba(231, 76, 60, 0.18);  color: #ff9f96; }
.badge.move     { background: rgba(52, 152, 219, 0.18); color: #8fd1ff; }
.badge.rollback { background: rgba(127, 140, 141, 0.18); color: #cfd6d6; }

/* 수량 강조 */
td.qty {
  text-align: right;
  font-weight: 900;
  min-width: 70px;
}
td.qty.plus  { color: #7dffb2; }
td.qty.minus { color: #ff9f96; }
td.qty.zero  { color: #7f8c8d; opacity: 0.75; }

/* 롤백 버튼 (작고 깔끔하게) */
.rollback-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.12);
  color: #ffb3b3;
  font-weight: 900;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.rollback-btn:hover {
  background: rgba(255, 107, 107, 0.22);
  border-color: rgba(255, 107, 107, 0.55);
}

/* 롤백 완료(비활성) */
.rollback-btn.disabled,
.rollback-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(1);
}

/* batch_id 표시(엑셀 업로드 묶음용) */
.batch-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(138, 180, 255, 0.25);
  background: rgba(138, 180, 255, 0.12);
  color: #bcd6ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* 같은 batch 그룹(옵션: tr에 data-batch 있으면) */
tr[data-batch] {
  border-left: 4px solid rgba(138, 180, 255, 0.5);
}
tr[data-batch]:hover {
  border-left-color: rgba(138, 180, 255, 1);
}

/* =====================================================
   MOBILE
===================================================== */
@media (max-width: 720px) {

  body { padding: 10px; }

  .grid, .grid2, .menu-grid { grid-template-columns: 1fr; }

  .card { padding: 14px; }

  button { padding: 14px; }

  .header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .header-bar h1 {
    text-align: center;
    font-size: 20px;
  }

  .logout-btn {
    width: 100%;
    text-align: center;
    padding: 12px;
  }

  /* 이력 표: 모바일에서는 조금 더 촘촘 */
  .table-wrap table {
    min-width: 860px;
    font-size: 12px;
  }
  .table-wrap td, .table-wrap th {
    padding: 9px 8px;
  }
}

/* =====================================================
   📅 CALENDAR (PC + MOBILE)
===================================================== */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.calendar-header h2 {
  margin: 0;
  font-size: 18px;
}

.calendar-header .nav-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #2a2f3a;
  background: #202736;
  color: #e6e6e6;
  cursor: pointer;
  font-size: 13px;
}

.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #9aa3b5;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}


.calendar-cell {
  background: #171a21;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  padding: 6px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.calendar-date {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #b9c0cf;
}

.calendar-memo {
  font-size: 12px;
  line-height: 1.3;
  color: #e6e6e6;
  white-space: pre-wrap;
  overflow: hidden;
}

.calendar-memo div {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-cell.today { border: 2px solid #8ab4ff; }
.calendar-cell.has-memo { background: #1f2533; }

.calendar-cell.clickable { cursor: pointer; }
.calendar-cell.clickable:hover { filter: brightness(1.1); }

@media (max-width: 720px) {
  .calendar-grid { gap: 4px; }
  .calendar-cell { min-height: 90px; padding: 5px; }
  .calendar-date { font-size: 11px; }
  .calendar-memo { font-size: 11px; }
}
/* =====================================================
   🚚 OUTBOUND (출고) – MODAL & UX
===================================================== */

/* 출고재고선택 버튼 (폼 안에서 버튼처럼 보이게) */
#btnSelectStock {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #2a2f3a;
  background: #202736;
  color: #e6e6e6;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
#btnSelectStock:hover {
  filter: brightness(1.1);
}

/* 모달 오버레이 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1200;
}

/* 모달 컨텐츠 */
.modal-content {
  background: #171a21;
  border: 1px solid #2a2f3a;
  border-radius: 14px;
  max-width: 820px;
  margin: 6% auto;
  padding: 16px;
  color: #e6e6e6;
}

/* 모달 제목 */
.modal-content h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 900;
}

/* 출고 재고 선택 테이블 */
#stockTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#stockTable th,
#stockTable td {
  padding: 9px 8px;
  border-bottom: 1px solid #2a2f3a;
  text-align: center;
}

#stockTable th {
  color: #b9c0cf;
  font-weight: 800;
}

/* 선택 가능한 행 hover */
#stockTable tbody tr {
  cursor: pointer;
}
#stockTable tbody tr:hover {
  background: rgba(138, 180, 255, 0.08);
}

/* 수량 강조 */
#stockTable td.qty {
  font-weight: 900;
  color: #7dffb2;
}

/* 모달 하단 버튼 영역 */
.modal-actions {
  margin-top: 12px;
  text-align: right;
}

/* 닫기 버튼 */
#btnCloseModal {
  width: auto;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #2a2f3a;
  background: #202736;
  color: #e6e6e6;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
#btnCloseModal:hover {
  filter: brightness(1.1);
}

/* 출고 남은 재고 표시 */
#remainQty {
  font-size: 13px;
  font-weight: 800;
  color: #9aa3b5;
}

/* readonly 입력 필드 시각적 구분 */
input[readonly] {
  background: #12151c;
  color: #b9c0cf;
  border-style: dashed;
}

/* 모바일 대응 */
@media (max-width: 720px) {
  .modal-content {
    margin: 10% 10px;
    padding: 14px;
  }

  #stockTable {
    font-size: 12px;
  }

  #stockTable th,
  #stockTable td {
    padding: 8px 6px;
  }
}
/* =========================
   📄 로케이션 QR 라벨 - LS 3108
========================= */

/* =========================
   📄 로케이션 QR 라벨 - LS 3108 (PRINT ONLY)
========================= */

@media print {

  body {
    background: #fff;
    padding: 0;
    color: #000;
  }

  /* 화면용 UI 전부 숨김 */
  .header-bar,
  .menu-grid,
  .card:not(.print-area),
  button,
  a {
    display: none !important;
  }

  /* A4 출력 설정 */
  @page {
    size: A4;
    margin: 5mm;
  }

  /* 전체 시트 */
  .sheet-3108 {
    display: grid;
    grid-template-columns: repeat(2, 99.1mm);
    grid-auto-rows: 38.1mm;
    gap: 2mm;
    justify-content: center;
  }

  /* 개별 라벨 */
  .label-3108 {
    width: 99.1mm;
    height: 38.1mm;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4mm;
    box-sizing: border-box;

    /* 🔴 실제 출력에서는 테두리 제거 */
    border: none;
  }

  /* QR 이미지 */
  .label-3108 img.qr {
    width: 30mm;
    height: 30mm;
  }

  /* 로케이션 텍스트 */
  .label-3108 .loc-text {
    font-size: 12pt;
    font-weight: 900;
    text-align: right;
  }
}

