/* 파일 책임: 공제 명세 테이블 스타일 */

/* ─────────────────────────────────────────────
   테이블 래퍼 (모서리 처리 + 스크롤)
───────────────────────────────────────────── */
.deduction-table-wrapper {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--color-border-subtle);
  /* 좁은 화면에서 가로 스크롤 허용 */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ─────────────────────────────────────────────
   테이블 기본
───────────────────────────────────────────── */
.deduction-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--text-sm);
}

/* ─────────────────────────────────────────────
   헤더
───────────────────────────────────────────── */
.deduction-table thead {
  background-color: var(--color-bg-subtle);
}

.deduction-table thead th {
  padding: 12px 16px;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-secondary);
  text-align: left;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border-subtle);
}

/* 금액 열 우측 정렬 */
.deduction-table thead th.amount {
  text-align: right;
}

/* ─────────────────────────────────────────────
   본문 행
───────────────────────────────────────────── */
.deduction-table tbody tr {
  transition: background-color 0.12s ease;
}

/* 줄무늬 (홀수 행: surface, 짝수 행: subtle) */
.deduction-table tbody tr:nth-child(odd) {
  background-color: var(--color-bg-surface);
}

.deduction-table tbody tr:nth-child(even) {
  background-color: var(--color-bg-subtle);
}

/* 호버 */
.deduction-table tbody tr:hover {
  background-color: var(--color-accent-primary-light);
}

.deduction-table tbody td {
  padding: 12px 16px;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border-subtle);
  vertical-align: middle;
  line-height: 1.5;
}

/* 마지막 본문 행 하단 테두리 제거 */
.deduction-table tbody tr:last-child td {
  border-bottom: none;
}

/* 항목명 열 */
.deduction-table tbody td:first-child {
  color: var(--color-text-primary);
  font-weight: var(--font-medium);
}

/* 금액 셀 */
.deduction-table tbody td.amount {
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* 공제 금액 (붉은색 옵션) */
.deduction-table tbody td.amount.is-deduction {
  color: var(--color-error);
}

/* 비고/설명 셀 */
.deduction-table tbody td.note {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

/* ─────────────────────────────────────────────
   푸터 (합계 행)
───────────────────────────────────────────── */
.deduction-table tfoot tr {
  background-color: var(--color-result-bg);   /* #1A1A2E */
}

.deduction-table tfoot td {
  padding: 14px 16px;
  color: var(--color-text-inverse);
  font-weight: var(--font-bold);
  font-size: var(--text-base);
  border-top: 2px solid rgba(255, 255, 255, 0.15);
  vertical-align: middle;
}

/* 합계 금액 셀 */
.deduction-table tfoot td.amount {
  color: var(--color-text-inverse);
  font-size: var(--text-lg);
  font-weight: var(--font-extrabold);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* 실수령액 강조 */
.deduction-table tfoot td.amount.is-net {
  color: var(--color-accent-teal-light);
}

/* ─────────────────────────────────────────────
   소계 행 (중간 합계)
───────────────────────────────────────────── */
.deduction-table tbody tr.subtotal {
  background-color: var(--color-bg-elevated) !important;
}

.deduction-table tbody tr.subtotal td {
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
  border-top: 1px solid var(--color-border-default);
  border-bottom: 1px solid var(--color-border-default);
}

.deduction-table tbody tr.subtotal td.amount {
  color: var(--color-accent-primary);
}

/* ─────────────────────────────────────────────
   반응형: 좁은 화면 대응
───────────────────────────────────────────── */
@media (max-width: 480px) {
  .deduction-table {
    font-size: var(--text-xs);
    table-layout: auto;
  }

  .deduction-table thead th,
  .deduction-table tbody td,
  .deduction-table tfoot td {
    padding: 10px 12px;
  }

  /* 비고 열 좁은 화면에서 숨김 */
  .deduction-table .col-note {
    display: none;
  }
}
