/* ================================================
   단말회수관리 (recovery.css)
   ================================================ */

/* ── 공통 리셋 / 베이스 ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Malgun Gothic', '맑은 고딕', Arial, sans-serif;
  font-size: 13px;
  background: #f0f2f5;
  color: #222;
}

/* ── GNB ── */
#hd { position: sticky; top: 0; z-index: 900; background: #1a2942; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
#gnb { width: 100%; }
.gnb-inner { display: flex; align-items: stretch; }
.menubar { display: flex; align-items: stretch; width: 100%; }

.menu-item {
  position: relative;
  display: flex;
  align-items: center;
}
.menu-item > a {
  display: flex; align-items: center; gap: 6px;
  padding: 0 16px; height: 46px;
  color: #cdd8e8; font-size: 13px; font-weight: 500;
  text-decoration: none; white-space: nowrap;
  transition: background .15s, color .15s;
}
.menu-item > a:hover,
.menu-item > a.active { background: #0f6fd8; color: #fff; }

.submenu {
  display: none; position: absolute; top: 100%; left: 0;
  min-width: 170px; background: #1e3050;
  box-shadow: 0 4px 16px rgba(0,0,0,.35); z-index: 999;
  border-top: 2px solid #0f6fd8; border-radius: 0 0 4px 4px;
}
.menu-item:hover .submenu { display: block; }
.submenu a {
  display: block; padding: 9px 16px;
  color: #b8c8e0; font-size: 12px; text-decoration: none;
  transition: background .12s;
}
.submenu a:hover,
.submenu a.active { background: #0f6fd8; color: #fff; }

.menubar-login { margin-left: auto; display: flex; align-items: center; gap: 10px; padding: 0 16px; color: #9ab; font-size: 12px; }
.login-user { display: flex; align-items: center; gap: 6px; color: #cdd8e8; }
.login-sep { color: #556; }
.btn-logout { color: #9ab; text-decoration: none; font-size: 12px; }
.btn-logout:hover { color: #fff; }

/* ── 로더 / 토스트 ── */
#loader {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(255,255,255,.4);
}
#loader::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 36px; height: 36px; margin: -18px 0 0 -18px;
  border: 4px solid #dde; border-top-color: #0f6fd8;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#toast {
  display: none; position: fixed; bottom: 30px; left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px; border-radius: 4px; font-size: 13px;
  font-weight: 500; color: #fff; z-index: 9998;
  white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
#toast.toast-show { display: block; }
#toast.toast-success { background: #27ae60; }
#toast.toast-error   { background: #e74c3c; }
#toast.toast-info    { background: #2980b9; }

/* ── 메인 래퍼 ── */
.rcv-wrap {
  max-width: 100%;
  margin: 0 auto;
  padding: 20px 20px 60px;
}

/* ── 페이지 헤더 ── */
.rcv-page-header { margin-bottom: 24px; }
.rcv-page-title {
  margin: 0 0 4px;
  font-size: 20px; font-weight: 700; color: #1a2942;
}
.rcv-page-title i { color: #0f6fd8; margin-right: 6px; }
.rcv-page-desc { margin: 0; color: #666; font-size: 12px; }

/* ════════════════════════════════════════════════
   상위 탭 (설치취소中 / 이삭中)
   ════════════════════════════════════════════════ */

/* 상위 탭 바 */
.rcv-main-tab-bar {
  display: flex;
  align-items: flex-end;
  gap: 0;
  background: #fff;
  border-bottom: 3px solid #0f6fd8;
  border-radius: 6px 6px 0 0;
  padding: 0 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* 상위 탭 버튼 */
.rcv-main-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 28px 11px;
  border: 1px solid transparent;
  border-bottom: none;
  background: #f0f2f5;
  cursor: pointer;
  font-size: 14px; font-weight: 700;
  color: #888;
  border-radius: 6px 6px 0 0;
  margin-bottom: -3px;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.rcv-main-tab:hover {
  color: #1a2942;
  background: #e8eef6;
}
.rcv-main-tab.active {
  background: #fff;
  color: #0f6fd8;
  border-color: #c8d4e4 #c8d4e4 #fff;
}
/* 이삭(中) 탭 — active 색상 보라 */
#main-tab-isak.active {
  color: #8e44ad;
  border-color: #c8d4e4 #c8d4e4 #fff;
}
#main-tab-isak:hover { color: #6c3483; }

/* 상위 탭 배지 */
.rcv-main-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 10px;
}
.rcv-main-tab-badge-cancel { background: #e74c3c; }
.rcv-main-tab-badge-isak   { background: #8e44ad; }

/* 상위 탭 메인 패널 */
.rcv-main-panel {
  background: #fff;
  border: 1px solid #c8d4e4;
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  overflow: hidden;
}
/* 패널 안의 매뉴얼/탭바/테이블 테두리 정리 */
.rcv-main-panel .rcv-manual {
  border-radius: 0;
  border-left: none; border-right: none; border-top: none;
  box-shadow: none;
  margin-bottom: 0;
}
.rcv-main-panel .rcv-tab-bar {
  border-radius: 0;
}
.rcv-main-panel .rcv-table-wrap {
  border-radius: 0;
  border-left: none; border-right: none; border-bottom: none;
  box-shadow: none;
}

/* ── 탭 바 ── */
.rcv-tab-bar {
  display: flex; align-items: center; gap: 4px;
  padding: 0 16px;
  background: #fafbfd;
  border-bottom: 2px solid #d0d8e4;
}
.rcv-tab {
  padding: 10px 20px; border: none; border-bottom: 3px solid transparent;
  background: none; cursor: pointer; font-size: 13px; font-weight: 600;
  color: #666; display: flex; align-items: center; gap: 6px;
  margin-bottom: -2px; border-radius: 0; transition: color .15s;
}
.rcv-tab:hover { color: #0f6fd8; }
.rcv-tab.active { color: #0f6fd8; border-bottom-color: #0f6fd8; }

/* 이삭(中) 탭 — active 색상을 보라색으로 */
#main-panel-isak .rcv-tab:hover { color: #8e44ad; }
#main-panel-isak .rcv-tab.active { color: #8e44ad; border-bottom-color: #8e44ad; }

.rcv-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  background: #e74c3c; color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 10px;
}
.rcv-tab-badge-done        { background: #27ae60; }
.rcv-tab-badge-isak        { background: #8e44ad; }
.rcv-tab-badge-isak-active { background: #8e44ad; }

.rcv-tab-spacer { flex: 1; }

/* ── 테이블 ── */
.rcv-table-wrap {
  background: #fff;
  border-radius: 6px;
  border: 1px solid #d8e0ea;
  overflow: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.rcv-table {
  width: 100%; border-collapse: collapse;
  min-width: 1800px;
}
.rcv-table-isak {
  min-width: 1700px;
}
.rcv-table thead th {
  background: #f0f4fa;
  border-bottom: 2px solid #c8d4e4;
  padding: 9px 10px;
  font-size: 12px; font-weight: 700; color: #3a4a6a;
  text-align: center; white-space: nowrap;
}
.rcv-table-isak thead th {
  background: #f7f0fc;
  border-bottom-color: #c9a8e0;
  color: #4a2a6a;
}
.rcv-table tbody tr { border-bottom: 1px solid #e8eef6; }
.rcv-table tbody tr:last-child { border-bottom: none; }
.rcv-table tbody tr:hover { background: #f5f8ff; }
.rcv-table-isak tbody tr:hover { background: #faf5ff; }
.rcv-table td {
  padding: 8px 10px; font-size: 12px; color: #333; vertical-align: middle;
}

.rcv-center { text-align: center; }
.rcv-mono { font-family: 'Consolas', monospace; font-size: 12px; color: #444; }
.rcv-date { text-align: center; color: #666; font-size: 11px; white-space: nowrap; }
.rcv-uid  { color: #0f6fd8; font-weight: 600; }

.rcv-memo-cell {
  max-width: 300px;
  white-space: pre-wrap; word-break: break-all;
  color: #555; font-size: 12px;
}

.rcv-action-cell { text-align: center; white-space: nowrap; }

.rcv-empty {
  text-align: center; padding: 40px 20px !important;
  color: #999; font-size: 14px;
}
.rcv-error { color: #e74c3c !important; }

/* 완료 탭 전용 컬럼 숨김 */
.hidden { display: none !important; }

/* 상태 뱃지 */
.rcv-state-badge {
  display: inline-block;
  padding: 2px 7px; border-radius: 10px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.rcv-state-open       { background: #d5f5e3; color: #1a7a40; border: 1px solid #82e0aa; }
.rcv-state-cancel-mid { background: #fdebd0; color: #b9500e; border: 1px solid #f0a458; }
.rcv-state-cancel     { background: #f2f3f4; color: #555;    border: 1px solid #ccc; }
.rcv-state-etc        { background: #eaf0fb; color: #2471a3; border: 1px solid #85c1e9; }
.rcv-state-isak       { background: #f5eef8; color: #6c3483; border: 1px solid #c39bd3; }

/* 처리유형 뱃지 */
.rcv-process-badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.rcv-process-complete { background: #d5f5e3; color: #1a7a40; border: 1px solid #58d68d; }
.rcv-process-replace  { background: #fde8d8; color: #d35400; border: 1px solid #f0a458; }
.rcv-process-refuse   { background: #f2f3f4; color: #555;    border: 1px solid #ccc; }

/* ── 버튼 공통 ── */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  border: none; border-radius: 3px; cursor: pointer;
  font-size: 12px; font-weight: 500; padding: 4px 10px;
  transition: opacity .15s, background .15s;
  text-decoration: none;
}
.btn:hover { opacity: .85; }
.btn-sm { padding: 3px 8px; font-size: 11px; }

.btn-blue       { background: #0f6fd8; color: #fff; }
.btn-orange     { background: #e67e22; color: #fff; }
.btn-sky        { background: #2980b9; color: #fff; }
.btn-danger     { background: #e74c3c; color: #fff; }
.btn-gray       { background: #95a5a6; color: #fff; }
.btn-outline-gray {
  background: transparent; color: #666;
  border: 1px solid #bbb; padding: 5px 12px;
}
.btn-outline-gray:hover { background: #f0f0f0; }
.btn-teal   { background: #16a085; color: #fff; }
.btn-teal:hover { background: #138d75; }

/* ── 이삭(中) 처리 버튼 3종 ── */
.btn-isak-complete { background: #16a085; color: #fff; }
.btn-isak-complete:hover { background: #138d75; }
.btn-isak-replace  { background: #d35400; color: #fff; }
.btn-isak-replace:hover  { background: #ba4a00; }
.btn-isak-refuse   { background: #7f8c8d; color: #fff; }
.btn-isak-refuse:hover   { background: #6c7a7d; }

/* ── 이삭(中) 처리 버튼 셀 ── */
.rcv-isak-action { white-space: nowrap; text-align: center; }
.rcv-isak-action .btn { margin-bottom: 3px; }

/* ── 이삭(中) 테이블 셀 구분 ── */
/* 기존단말/기존일련번호: 회수 대상 → 강하게 강조 */
.rcv-isak-old {
  color: #c0392b;
  font-weight: 700;
  font-size: 13px;
}
/* 교체단말/교체일련번호: 참고 정보 → 흐리게 */
.rcv-isak-new {
  color: #95a5a6;
  font-weight: 400;
  font-size: 12px;
}

/* ════════════════════════════════════════════════
   운영 매뉴얼
   ════════════════════════════════════════════════ */
.rcv-manual {
  background: #fff;
  border: 1px solid #d8e0ea;
  border-radius: 6px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  overflow: hidden;
}
.rcv-manual-cancel .rcv-manual-toggle {
  background: #f0f6ff;
  border-bottom: 1px solid #c8daf5;
}
.rcv-manual-cancel .rcv-manual-toggle:hover { background: #e4effc; }
.rcv-manual-isak .rcv-manual-toggle {
  background: #f8f0fd;
  border-bottom: 1px solid #dcc5f0;
}
.rcv-manual-isak .rcv-manual-toggle:hover { background: #f0e4fb; }

.rcv-manual-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 16px;
  background: #f5f8ff;
  border-bottom: 1px solid #d8e0ea;
  cursor: pointer;
  font-size: 13px; font-weight: 700; color: #1a2942;
  user-select: none;
  transition: background .15s;
}
.rcv-manual-chevron { margin-left: auto; transition: transform .25s; color: #666; }

.rcv-manual-body {
  display: none;
  padding: 18px 20px 20px;
}
.rcv-manual-body.open { display: block; }

.rcv-manual-cols {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 20px;
}
.rcv-manual-cols-isak {
  grid-template-columns: 1fr 1fr 1.4fr 1fr;
}
@media (max-width: 1400px) {
  .rcv-manual-cols,
  .rcv-manual-cols-isak { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .rcv-manual-cols,
  .rcv-manual-cols-isak { grid-template-columns: 1fr; }
}

.rcv-manual-section { }
.rcv-manual-section-title {
  font-size: 12px; font-weight: 700; color: #2c3e50;
  padding-bottom: 8px; margin-bottom: 10px;
  border-bottom: 2px solid #e8eef6;
  display: flex; align-items: center; gap: 6px;
}

.rcv-manual-item {
  display: flex; gap: 8px; align-items: flex-start;
  margin-bottom: 12px;
}
.rcv-manual-text {
  font-size: 12px; color: #333; line-height: 1.7;
}
.rcv-manual-text code {
  background: #f0f4fa; border: 1px solid #c8d4e4;
  border-radius: 3px; padding: 1px 5px;
  font-size: 11px; color: #c0392b; font-family: 'Consolas', monospace;
}
.rcv-manual-note {
  display: block; margin-top: 3px;
  font-size: 11px; color: #888; font-style: italic;
}

/* 뱃지 */
.rcv-badge {
  display: inline-block; white-space: nowrap;
  padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 700; flex-shrink: 0; margin-top: 2px;
}
.rcv-badge-orange { background: #fdebd0; color: #e67e22; border: 1px solid #f0a458; }
.rcv-badge-green  { background: #d5f5e3; color: #1e8449; border: 1px solid #58d68d; }
.rcv-badge-purple { background: #f5eef8; color: #6c3483; border: 1px solid #c39bd3; }

/* 절차 스텝 */
.rcv-manual-steps { display: flex; flex-direction: column; gap: 8px; }
.rcv-step {
  display: flex; gap: 10px; align-items: flex-start;
}
.rcv-step-num {
  flex-shrink: 0;
  width: 22px; height: 22px;
  background: #0f6fd8; color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; margin-top: 1px;
}
.rcv-step-num-green  { background: #16a085; }
.rcv-step-num-orange { background: #d35400; }
.rcv-step-num-gray   { background: #7f8c8d; }

.rcv-step-desc {
  font-size: 12px; color: #333; line-height: 1.7;
}
.rcv-step-desc code {
  background: #f0f4fa; border: 1px solid #c8d4e4;
  border-radius: 3px; padding: 1px 5px;
  font-size: 11px; color: #c0392b; font-family: 'Consolas', monospace;
}

/* 주의사항 */
.rcv-manual-caution-list {
  margin: 0; padding-left: 18px;
  font-size: 12px; color: #444; line-height: 1.9;
}
.rcv-manual-caution-list li { margin-bottom: 4px; }
.rcv-manual-caution-list code {
  background: #f0f4fa; border: 1px solid #c8d4e4;
  border-radius: 3px; padding: 1px 5px;
  font-size: 11px; color: #c0392b; font-family: 'Consolas', monospace;
}

/* ════════════════════════════════════════════════
   재고 흐름도
   ════════════════════════════════════════════════ */
.rcv-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.rcv-flow-node {
  width: 100%;
  text-align: center;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 12px; line-height: 1.6;
  border: 1px solid #d0dce8;
}
.rcv-flow-node code {
  background: rgba(255,255,255,.6);
  border: 1px solid #c8d4e4;
  border-radius: 3px; padding: 1px 5px;
  font-size: 11px; color: #c0392b; font-family: 'Consolas', monospace;
}
.rcv-flow-node-trigger {
  background: #eaf4ff;
  border-color: #9ac4f0;
  color: #1a4a80;
}
.rcv-flow-node-trigger-isak {
  background: #f5eef8;
  border-color: #c39bd3;
  color: #4a1a70;
}
.rcv-flow-node-stock {
  background: #fef5f5;
  border-color: #f5b7b1;
  color: #922b21;
}
.rcv-flow-node-in {
  background: #eafaf1;
  border-color: #82e0aa;
  color: #1d6a38;
}
.rcv-flow-node-done {
  background: #eaf4ff;
  border-color: #9ac4f0;
  color: #1a4a80;
  font-weight: 600;
}
.rcv-flow-note {
  display: block;
  font-size: 10px; color: #888; font-style: italic; margin-top: 2px;
}

.rcv-flow-arrow {
  font-size: 11px; color: #999;
  padding: 3px 0;
  text-align: center;
  white-space: nowrap;
}

/* 이삭(中) 3분기 분기 */
.rcv-flow-branch {
  display: flex;
  gap: 6px;
  width: 100%;
  margin: 0;
}
.rcv-flow-branch-item {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  border-radius: 6px;
  font-size: 11px; line-height: 1.6;
  border: 1px solid #ddd;
}
.rcv-flow-branch-label {
  font-weight: 700; font-size: 11px;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.rcv-flow-branch-green  { background: #eafaf1; border-color: #82e0aa; color: #1d6a38; }
.rcv-flow-branch-orange { background: #fef0e6; border-color: #f0a458; color: #7d3a00; }
.rcv-flow-branch-gray   { background: #f4f5f6; border-color: #c8cfd2; color: #555; }

/* ── 메모 모달 ── */
.rcv-modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
}
.rcv-modal {
  background: #fff; border-radius: 6px; width: 480px; max-width: 95vw;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.rcv-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #e0e8f0;
  font-size: 14px; font-weight: 700; color: #1a2942;
}
.rcv-modal-close {
  background: none; border: none; font-size: 20px; color: #999;
  cursor: pointer; padding: 0 4px; line-height: 1;
}
.rcv-modal-close:hover { color: #333; }
.rcv-modal-body { padding: 16px 18px; }
.rcv-memo-input {
  width: 100%; resize: vertical; border: 1px solid #c8d4e4;
  border-radius: 4px; padding: 8px; font-size: 13px;
  font-family: inherit; outline: none; min-height: 90px;
}
.rcv-memo-input:focus { border-color: #0f6fd8; box-shadow: 0 0 0 2px rgba(15,111,216,.12); }
.rcv-modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid #e8eef6;
}
