/* 2026-10-15 .hist-scope-btns: 칸 수에 맞춰 같은 넓이 (견적 이력 3칸, 고객사 2칸) */
/* 2026-10-15 .sp-status-extra .sp-date: 날짜가 하이픈에서 끊기지 않게 */
/* 2026-10-09 5-3 견적 이력 목록·카드: 영업 현황 = 패널 배지 + 알림 태그(hsl-tag), 관리 버튼 = 보조 버튼 모양(32px), 마우스 올림 색은 PC 에서만(@media hover), 겹친 규칙 합침 */
/* 2026-10-09 5-2 영업 패널 정리: 기준표(--ds-*) 글자·색·버튼 3종, 상태 배지 연한 바탕, 겹친 규칙 합침 */
/* 2026-10-09 5-0 죽은 규칙 정리: JS·HTML 에 없는 클래스만 가리키는 규칙 삭제 (지운규칙목록.txt) */
/* 2026-10-09 style.css 에서 분리 (원래 3143~4180줄) */
/* 2026-10-09 하위 메뉴 띠 디자인 통일 (quote-type-bar, qtype-btn) / 전체·내 견적 토글 */
/* ================================================================
   영업 상세 패널 (sales-panel) — 3-2
   ================================================================ */
/* 오버레이 */
.sp-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.25);
  z-index: 1100;
}
.sp-overlay.open { display: block; }

/* 패널 본체 */
.sales-panel {
  position: fixed; top: 0; right: 0;
  width: 400px; max-width: 100vw; height: 100dvh;
  background: #fff;
  box-shadow: -4px 0 24px rgba(27,58,107,.13);
  z-index: 1101;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.sales-panel.open { transform: translateX(0); }

/* 헤더 */
.sp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ds-gray-200);
  flex-shrink: 0;
  background: #f8fafc;
}
.sp-header-title { font-size: var(--ds-fs-lg); font-weight: 700; color: var(--ds-brand); }
.sp-close {
  width: 28px; height: 28px; border: none; background: none;
  font-size: 16px; color: #64748b; cursor: pointer; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.sp-close:hover { background: #f1f5f9; color: #1B3A6B; }

/* 바디 스크롤 */
.sp-body {
  flex: 1; overflow-y: auto; padding: 0;
  -webkit-overflow-scrolling: touch;
}

/* 섹션 */
.sp-section {
  padding: var(--ds-sp-4);
  border-bottom: 1px solid var(--ds-gray-200);
}
/* 섹션 제목 (영업 정보·활동 기록·편집 제목 공통) */
.sp-section-title,
.sp-summary-label-title { font-size: var(--ds-fs-base); font-weight: 700; color: var(--ds-brand); }

/* 요약 그리드 */
.sp-summary { display: flex; flex-direction: column; gap: var(--ds-sp-2); }
.sp-summary-row { display: flex; align-items: baseline; gap: var(--ds-sp-2); }
.sp-label {
  font-size: var(--ds-fs-sm); color: var(--ds-gray-600); min-width: 112px; flex-shrink: 0;
}
.sp-value { font-size: var(--ds-fs-base); color: var(--ds-gray-900); }
.sp-value.fw-700 { font-weight: 700; }

/* 견적번호 링크 [신규] */
.sp-qnum-link {
  color: var(--ds-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font-weight: 700;
  font-size: inherit;
  white-space: nowrap;
}
.sp-qnum-link:hover { color: var(--ds-primary-dark); }
.sp-qnum-sep { color: #94a3b8; font-weight: 400; }

/* 영업상태 배지 — 연한 바탕 + 진한 글자 (실주는 회색, 빨강은 '지연'에만). 견적 이력 알림 태그(.hsl-tag)도 같은 모양 */
.sp-status-badge, .hsl-tag {
  display: inline-block; padding: 2px 8px; border-radius: var(--ds-radius-sm);
  font-size: var(--ds-fs-sm); font-weight: 600; line-height: 1.5;
}
.sp-status-badge--in_progress { background: #eff6ff; color: var(--ds-progress); }
.sp-status-badge--on_hold, .hsl-tag--warn { background: #fff7ed; color: var(--ds-warn); }
.hsl-tag--danger              { background: #fef2f2; color: var(--ds-danger); }
.sp-status-badge--won         { background: #ecfdf5; color: var(--ds-success); }
.sp-status-badge--lost,
.sp-status-badge--none, .hsl-tag--muted { background: #f1f5f9; color: var(--ds-gray-600); }
/* 배지 옆 수주일·재검토일·실주 사유 */
.sp-status-extra { display: inline-block; vertical-align: top; max-width: calc(100% - 64px); margin-left: var(--ds-sp-2); font-size: var(--ds-fs-sm); line-height: 1.5; word-break: keep-all; color: var(--ds-gray-600); }
.sp-status-extra .sp-date { white-space: nowrap; }

/* 영업관리 전 안내 */
.sp-no-sales {
  text-align: center; padding: 28px 16px;
  color: #94a3b8; font-size: 13px; line-height: 1.7;
}
.sp-no-sales-icon { font-size: 32px; margin-bottom: 8px; }
.sp-no-sales-sub  { font-size: var(--ds-fs-sm); color: var(--ds-gray-400); margin-top: 6px; }

/* 활동 로그 섹션 */
.sp-acts-section { background: #fafbff; }

/* 빈 상태 / 로딩 / 오류 */
.sp-act-empty { font-size: var(--ds-fs-md); color: var(--ds-gray-400); text-align: center; padding: 20px 0; }
.sp-loading   { font-size: 13px; color: #94a3b8; text-align: center; padding: 40px 0; }
.sp-error     { font-size: 12px; color: #ef4444; text-align: center; padding: 24px 16px; }

/* 모바일 대응 */
@media (max-width: 600px) {
  .sales-panel { width: 100vw; }
}

/* ── 3-3: 영업 정보 헤더 (보기/편집 공통) ── */
.sp-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--ds-sp-3);
}

/* ── 3-3: 편집 폼 ── */
.sp-edit-form { display: flex; flex-direction: column; gap: 0; }

.sp-edit-row {
  display: flex;
  align-items: center;
  gap: var(--ds-sp-2);
  padding: var(--ds-sp-2) 0;
  border-bottom: 1px solid #f1f5f9;
}
.sp-edit-row:last-child { border-bottom: none; }

.sp-edit-readonly {
  opacity: .7;
}

.sp-edit-form .sp-label { flex: 0 0 112px; }

/* 입력칸 공통 (선택·입력·여러 줄) */
.sp-select,
.sp-input {
  flex: 1;
  height: 36px;
  padding: 0 var(--ds-sp-2);
  border: 1px solid #cbd5e1;
  border-radius: var(--ds-radius-md);
  font-size: var(--ds-fs-base);
  color: var(--ds-gray-900);
  background: #fff;
  min-width: 0;
}
.sp-select { cursor: pointer; }
.sp-select:focus,
.sp-input:focus,
.sp-textarea:focus {
  outline: none;
  border-color: var(--ds-primary);
  box-shadow: 0 0 0 2px rgba(46,127,193,.15);
}
.sp-input[type="date"] { font-family: inherit; }

/* 저장/취소 버튼 행 */
.sp-edit-actions {
  display: flex;
  gap: var(--ds-sp-2);
  padding-top: var(--ds-sp-4);
}
/* 버튼 3종 — 주요(파랑 꽉 참) / 보조(흰 바탕 테두리) / 글자 버튼(.sp-act-btn) */
.sp-save-btn,
.sp-cancel-btn,
.sp-act-bottom-btn,
.sp-edit-btn {
  height: 36px;
  padding: 0 var(--ds-sp-4);
  border-radius: var(--ds-radius-md);
  font-size: var(--ds-fs-base);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.sp-save-btn {
  flex: 1;
  border: 1px solid var(--ds-primary);
  background: var(--ds-primary);
  color: #fff;
}
@media (hover: hover) { .sp-save-btn:hover:not(:disabled) { background: var(--ds-primary-dark); border-color: var(--ds-primary-dark); } }
.sp-save-btn:disabled { opacity: .5; cursor: not-allowed; }
.sp-cancel-btn,
.sp-act-bottom-btn,
.sp-edit-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: var(--ds-gray-900);
}
.sp-cancel-btn { flex: 1; }
@media (hover: hover) {
.sp-cancel-btn:hover, .sp-act-bottom-btn:hover, .sp-edit-btn:hover { border-color: var(--ds-primary); color: var(--ds-primary); } }
.sp-edit-btn { height: 32px; padding: 0 var(--ds-sp-3); font-size: var(--ds-fs-md); }

/* 필수 입력 표시 */
.sp-required { color: #ef4444; font-size: 10px; margin-left: 1px; }

/* ══════════════════════════════════════════════════════════════
   3-4 활동 로그 섹션
═══════════════════════════════════════════════════════════════ */

/* ── 활동 로그 입력폼 컨테이너 ── */
.sp-act-form {
  background: #f8fafc;
  border: 1px solid var(--ds-gray-200);
  border-radius: var(--ds-radius-md);
  padding: var(--ds-sp-4);
  margin-bottom: var(--ds-sp-3);
}

/* 폼 제목 */
.sp-act-form-title {
  font-size: var(--ds-fs-base);
  font-weight: 700;
  color: var(--ds-brand);
  margin: 0 0 var(--ds-sp-2);
}

/* 폼 행 */
.sp-act-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.sp-act-form-row--full {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 4px 0;
}

/* 폼 라벨 */
.sp-act-form-label {
  font-size: var(--ds-fs-sm);
  color: var(--ds-gray-600);
  white-space: nowrap;
  min-width: 80px;
}
.sp-act-form-row--full .sp-act-form-label {
  min-width: unset;
}

/* 텍스트에어리어 */
.sp-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: var(--ds-radius-md);
  padding: var(--ds-sp-2);
  font-size: var(--ds-fs-base);
  font-family: inherit;
  color: var(--ds-gray-900);
  background: #fff;
  resize: vertical;
  min-height: 64px;
  box-sizing: border-box;
  transition: border-color .12s, box-shadow .12s;
}

/* 폼 버튼 행 */
.sp-act-form-actions {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  justify-content: flex-end;
}
.sp-act-form-actions .sp-save-btn,
.sp-act-form-actions .sp-cancel-btn {
  flex: 0 0 auto;
  padding: 0 var(--ds-sp-6);
}

/* ── 관리자 코멘트 폼 ── */
.sp-comment-form {
  background: #fef9ec;
  border: 1px solid #fde68a;
  border-radius: var(--ds-radius-md);
  padding: var(--ds-sp-4);
  margin-bottom: var(--ds-sp-3);
}
.sp-comment-form .sp-act-form-title { color: #92400e; }
.sp-comment-form .sp-textarea {
  border-color: #fcd34d;
  background: #fffdf5;
}
.sp-comment-form .sp-textarea:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245,158,11,.15);
}

/* ── 활동 로그 항목 수정/삭제 버튼 영역 ── */
.sp-act-actions {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

/* 수정·삭제 = 회색 글자 버튼 (누를 때만 색) */
.sp-act-btn {
  padding: 2px 4px;
  border: none;
  background: none;
  font-size: var(--ds-fs-sm);
  color: var(--ds-gray-400);
  cursor: pointer;
  line-height: 1.5;
}
@media (hover: hover) { .sp-act-btn--edit:hover { color: var(--ds-primary); }
.sp-act-btn--del:hover  { color: var(--ds-danger); } }

/* ══════════════════════════════════════════════════════════════
   4-0 타임라인: 작성자 오른쪽 고정 그룹
═══════════════════════════════════════════════════════════════ */
.sp-tl-right-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   3-6 활동 로그 타임라인
═══════════════════════════════════════════════════════════════ */

/* 섹션 헤더 */
.sp-acts-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--ds-sp-3); }
.sp-acts-order-label { font-size: var(--ds-fs-sm); color: var(--ds-gray-400); }

/* 미확인 코멘트 알림 박스 */
.sp-unread-alert {
  background: #fef9ec;
  border: 1.5px solid #fcd34d;
  border-radius: 8px;
  padding: 10px 13px;
  margin-bottom: 12px;
}
.sp-unread-alert-meta {
  font-size: 12px;
  color: #92400e;
  font-weight: 600;
  margin-bottom: 4px;
}
.sp-unread-alert-content {
  font-size: var(--ds-fs-base);
  color: #1e293b;
  font-weight: 500;
  line-height: 1.5;
}

/* 타임라인 컨테이너 */
.sp-timeline { display: flex; flex-direction: column; }

/* 타임라인 한 항목 */
.sp-tl-item {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

/* 왼쪽: 번호 동그라미 + 세로선 */
.sp-tl-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 24px;
}

/* 번호 동그라미 */
.sp-tl-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  border: 1.5px solid;
  line-height: 1;
}
.sp-tl-dot--system  { background: #f1f5f9; border-color: #cbd5e1; color: #64748b; }
.sp-tl-dot--normal  { background: #eff6ff; border-color: #93c5fd; color: #2563eb; }
.sp-tl-dot--comment { background: #fef9ec; border-color: #fcd34d; color: #d97706; }

/* 세로 연결선 */
.sp-tl-line {
  flex: 1;
  width: 1.5px;
  background: #e2e8f0;
  margin-top: 3px;
  min-height: 12px;
}
.sp-tl-line--last { background: transparent; }

/* 오른쪽: 내용 영역 */
.sp-tl-right {
  flex: 1;
  min-width: 0;
  padding-bottom: 14px;
}

/* 헤더 행: 날짜 · 유형  (오른쪽: 작성자 + 버튼) */
.sp-tl-header {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.sp-tl-date {
  font-size: var(--ds-fs-md);
  font-weight: 700;
  color: var(--ds-gray-900);
  white-space: nowrap;
}
.sp-tl-sep { font-size: var(--ds-fs-md); color: var(--ds-gray-400); }

/* 유형 텍스트 색상 */
.sp-tl-type         { font-size: var(--ds-fs-md); font-weight: 600; }
.sp-tl-type--system  { color: var(--ds-gray-600); }
.sp-tl-type--normal  { color: var(--ds-progress); }
.sp-tl-type--comment { color: var(--ds-warn); }

/* 작성자 (우측으로 밀기) */
.sp-tl-author {
  margin-left: auto;
  font-size: var(--ds-fs-sm);
  color: var(--ds-gray-400);
  white-space: nowrap;
}

/* 내용 */
.sp-tl-content {
  font-size: var(--ds-fs-base);
  color: var(--ds-gray-900);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
}

/* F/U 배지 — 상태 배지와 같은 모양 */
.sp-fu-badge {
  display: inline-block;
  margin-top: var(--ds-sp-1);
  padding: 2px 8px;
  background: #eff6ff;
  color: var(--ds-progress);
  border-radius: var(--ds-radius-sm);
  font-size: var(--ds-fs-sm);
  font-weight: 600;
}

/* 요청/지시 확인/미확인 표시 */
.sp-comment-read   { font-size: var(--ds-fs-sm); color: var(--ds-success); font-weight: 600; }
.sp-comment-unread { font-size: var(--ds-fs-sm); color: var(--ds-warn); font-weight: 600; }

/* 하단 버튼 두 개 (모양은 위 '보조' 버튼) */
.sp-act-bottom-btns {
  display: flex;
  gap: var(--ds-sp-2);
  margin-top: var(--ds-sp-2);
  padding-top: var(--ds-sp-3);
  border-top: 1px solid var(--ds-gray-200);
}
.sp-act-bottom-btn { flex: 1; }

/* ── 하위 메뉴 띠 (구매/렌탈, 제품 관리 탭) — 2026-10-09
   하늘색 띠, 선택 = 진한 파랑 칸. 왼쪽 여백 = 로고 칸 폭 (메인 메뉴 첫 글자 아래에서 시작) ── */
.quote-type-bar {
  display: flex;
  align-items: center;
  gap: var(--ds-sp-1);
  height: var(--ds-subband-h);
  padding: 0 var(--ds-sp-4) 0 var(--ds-header-logo-w);
  background: var(--ds-band);
  border-bottom: none;
  flex-shrink: 0;
  overflow-x: auto; scrollbar-width: none;
}
.quote-type-bar::-webkit-scrollbar { display: none; }
.qtype-btn {
  display: flex; align-items: center;
  padding: 6px 14px;
  font-size: var(--ds-fs-base); font-weight: 400; cursor: pointer;
  border: none; border-radius: var(--ds-radius-md);
  background: transparent; color: var(--ds-band-text);
  white-space: nowrap; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.qtype-btn i { display: none; } /* 아이콘 숨김 (HTML 은 그대로 둠) */
.qtype-btn:hover { background: rgba(255,255,255,.5); color: var(--ds-brand); }
.qtype-btn.active { background: var(--ds-primary); color: #ffffff; font-weight: 500; }
@media screen and (max-width: 600px) {
  .quote-type-bar { height: var(--ds-subband-h-mobile); padding: 0 var(--ds-sp-3); }
  .qtype-btn { font-size: var(--ds-fs-md); padding: 5px 10px; }
}

/* ── 목록 관리 패널 서브탭 ── */
.catalog-sub-panel { display: block; flex: 1; overflow: auto; }

/* ══════════════════════════════════════════════════════════════
   4-2 견적 이력 화면 개편
══════════════════════════════════════════════════════════════ */

/* ── 내 견적 / 전체 토글 버튼 — 2026-10-09 테두리 하나에 붙은 칸, 고른 칸만 파랑 (품목 창 단위 버튼과 같은 모양) ── */
.hist-scope-btns {
  display: inline-grid;
  grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 0;
  padding: 0;
  height: 32px;
  background: #ffffff;
  border: var(--ds-line) solid var(--ds-primary);
  border-radius: var(--ds-radius-md);
  overflow: hidden;
  flex-shrink: 0;
}
.hist-scope-btn {
  padding: 0 14px;
  font-size: var(--ds-fs-md);
  font-weight: 400;
  background: transparent;
  color: var(--ds-primary);
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: background .12s, color .12s;
  line-height: 1;
  white-space: nowrap;
}
.hist-scope-btn + .hist-scope-btn {
  border-left: var(--ds-line) solid var(--ds-primary);
}
.hist-scope-btn.active {
  background: var(--ds-primary);
  color: #ffffff;
  font-weight: 500;
}
.hist-scope-btn:hover:not(.active) {
  background: var(--ds-primary-soft);
}

/* ── 견적번호 옆 상태 태그 (작성중 / 반려) ── */
.hist-status-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: var(--ds-radius-sm);
  font-size: var(--ds-fs-xs);
  font-weight: 600;
  vertical-align: middle;
  line-height: 1.5;
}
.hist-status-tag--draft    { background: #f1f5f9; color: var(--ds-gray-600); }
.hist-status-tag--rejected { background: #fef2f2; color: var(--ds-danger); }

/* ── 고객사 아래 담당자 소글씨 ── */
.hist-contact-sub {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 400;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* ── ··· 더보기 메뉴 ── */
.hist-dots-wrap {
  position: relative;
  display: inline-block;
}
.hist-dots-btn { font-size: 16px; letter-spacing: 1px; line-height: 1; } /* 모양은 아래 .hist-icon-btn 과 같은 규칙 */
/* ── 원본 메뉴 div는 항상 숨김 (콘텐츠만 보관) — fixed 팝업이 _dots-float-menu에 복사해 표시 ── */
.hist-dots-menu {
  display: none !important;
}
/* float 팝업 항목 스타일 (컨테이너 레이아웃은 JS cssText로 설정, 항목 색상·간격은 여기서 관리) */
.hist-dots-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: background .1s;
  box-sizing: border-box;
}
.hist-dots-item:hover {
  background: #f1f5f9;
}
.hist-dots-item--danger {
  color: #dc2626;
}
.hist-dots-item--danger:hover {
  background: #fef2f2;
}

/* ── 금액 오른쪽 정렬 ── */
.text-right { text-align: right !important; }
td.text-right { text-align: right; }

/* ── 관리 칸 버튼 그룹 (td 내부에만 flex) ── */
.hist-action-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  justify-content: flex-start;
}

/* ── 관리 버튼: 아이콘(미리보기 눈 / 수정 연필)·⋯·수정견적 = 영업 패널 '보조' 버튼 모양, 높이 32 ── */
.hist-icon-btn,
.hist-dots-btn,
.hist-rev-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: var(--ds-radius-md);
  background: #fff;
  color: var(--ds-gray-600);
  cursor: pointer;
  padding: 0;
  transition: border-color .12s, color .12s;
  flex-shrink: 0;
}
@media (hover: hover) {
.hist-icon-btn:hover, .hist-dots-btn:hover, .hist-rev-btn:hover { border-color: var(--ds-primary); color: var(--ds-primary); } }
.hist-icon-btn svg {
  width: 15px;
  height: 15px;
  display: block;
}

/* 수정견적 글자 버튼 — 모양은 위 규칙, 폭·글자만 */
.hist-rev-btn { width: auto; padding: 0 var(--ds-sp-3); color: var(--ds-gray-900); font-size: var(--ds-fs-md); font-weight: 600; white-space: nowrap; }

/* ── 영업 현황 칸 ── */
.hist-sales-cell-wrap {
  overflow: hidden;
  padding-right: 24px !important; /* 합계↔영업현황 최소 여백 */
}
/* 배지·태그 모양은 위쪽 .sp-status-badge 규칙 */
.hsl-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
  font-size: var(--ds-fs-sm);
}
.hsl-extra { color: var(--ds-gray-600); }
.hsl-none  { color: var(--ds-gray-400); font-size: var(--ds-fs-md); }

/* ══════════════════════════════════════════════════════════
   ■ 이력 테이블 고정 칸 폭 (구매·렌탈 공통)
   table-layout: fixed 를 HTML에 이미 명시하지 않으므로 CSS로 강제
   ══════════════════════════════════════════════════════════ */
#history-table,
#r-history-table {
  table-layout: fixed !important;
  width: 100%;
}

/* ── 구매 이력 ── */
#history-table th:nth-child(1), #history-table td:nth-child(1) { width: 15%; } /* 견적번호 */
#history-table th:nth-child(2), #history-table td:nth-child(2) { width:  7%; } /* 작성일   */
#history-table th:nth-child(3), #history-table td:nth-child(3) { width: 21%; } /* 고객사   */
#history-table th:nth-child(4), #history-table td:nth-child(4) { width: 10%; } /* 영업담당 */
#history-table th:nth-child(5), #history-table td:nth-child(5) { width: 11%; } /* 합계     */
#history-table th:nth-child(6), #history-table td:nth-child(6) { width: 21%; } /* 영업 현황 */
#history-table th:nth-child(7), #history-table td:nth-child(7) { width: 15%; } /* 관리     */

/* ── 렌탈 이력 ── */
#r-history-table th:nth-child(1), #r-history-table td:nth-child(1) { width: 15%; }
#r-history-table th:nth-child(2), #r-history-table td:nth-child(2) { width:  7%; }
#r-history-table th:nth-child(3), #r-history-table td:nth-child(3) { width: 21%; }
#r-history-table th:nth-child(4), #r-history-table td:nth-child(4) { width: 10%; }
#r-history-table th:nth-child(5), #r-history-table td:nth-child(5) { width: 11%; }
#r-history-table th:nth-child(6), #r-history-table td:nth-child(6) { width: 21%; }
#r-history-table th:nth-child(7), #r-history-table td:nth-child(7) { width: 15%; }

/* ── 공통: 칸 안 글자 말줄임, 세로 중앙 ── */
#history-table th,   #history-table td,
#r-history-table th, #r-history-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* ── 합계 칸: 제목·숫자 오른쪽 정렬 (5번째) ── */
#history-table th:nth-child(5),   #history-table td:nth-child(5),
#r-history-table th:nth-child(5), #r-history-table td:nth-child(5) {
  text-align: right;
}

/* ── 관리 칸: 제목·버튼 왼쪽 정렬 (7번째) ── */
#history-table th:nth-child(7),   #history-table td:nth-child(7),
#r-history-table th:nth-child(7), #r-history-table td:nth-child(7) {
  text-align: left;
  overflow: visible; /* ···메뉴가 잘리지 않도록 */
}
