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

body {
  font-family: 'Pretendard', -apple-system, sans-serif;
  background: #f5f7fa;
  color: #1a1a2e;
  padding: 0;
  max-width: 1280px;
  margin: 0 auto;
}

/* 상단 헤더 */
.top-header {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 32px;
  background: linear-gradient(135deg, #D4C4B0, #CCBEAD);
  height: 56px;
}
.top-header h1 {
  font-size: 18px;
  font-weight: 700;
  color: #0a6666;
  white-space: nowrap;
}
.nav-menu {
  display: flex;
  gap: 4px;
  height: 100%;
}
.nav-item {
  display: flex;
  align-items: center;
  padding: 0 20px;
  color: #6c757d;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.nav-item:hover { color: #0a6666; }
.nav-item.active {
  color: #0a6666;
  font-weight: 700;
  border-bottom-color: #0a6666;
}

/* 페이지 */
.page { display: none; padding: 24px 32px; }
.page.active { display: block; }
.page-empty {
  text-align: center;
  padding: 80px 0;
  color: #6c757d;
  font-size: 15px;
}

/* 페이지 툴바 */
.page-toolbar {
  margin-bottom: 24px;
}
.date-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}
.date-picker input[type="date"] {
  padding: 6px 10px;
  border: 1px solid #CCBEAD;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.date-picker button, #btnLoad {
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  background: #0a6666;
  color: #fff;
  font-weight: 600;
}
.btn-secondary {
  background: #D4C4B0 !important;
  color: #1a1a2e !important;
}
.btn-secondary:hover { background: #CCBEAD !important; }
#btnLoad:hover { background: #085252; }
.btn-nav {
  padding: 6px 10px;
  border: 1px solid #CCBEAD;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #0a6666;
  line-height: 1;
}
.btn-nav:hover { background: #f0ebe4; }

/* 로딩 / 에러 */
.loading {
  text-align: center;
  padding: 40px;
  font-size: 16px;
  color: #6c757d;
}
.error-banner {
  background: #fef2f2;
  border: 1px solid #dc3545;
  color: #dc3545;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}

/* 요약 카드 */
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border-left: 4px solid #0a6666;
}
.card-green { border-left-color: #0a6666; }
.card-red { border-left-color: #dc3545; }
.card-blue { border-left-color: #B1888D; }
.card-label {
  font-size: 13px;
  color: #6c757d;
  margin-bottom: 6px;
}
.card-value {
  font-size: 26px;
  font-weight: 700;
}

/* 차트 */
.chart-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 16px;
  margin-bottom: 24px;
}
.chart-box {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.chart-box h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #0a6666;
}

/* 테이블 섹션 */
.table-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}
.table-section h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #B1888D;
}
.table-section h2 small {
  font-weight: 400;
  color: #6c757d;
  font-size: 13px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  background: #0a6666;
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}
tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid #e8e0d8;
}
tbody tr:nth-child(even) { background: #faf8f5; }
tbody tr:hover { background: #f0ebe4; }

/* 금액 정렬 */
.text-right { text-align: right; }

/* 신뢰도 뱃지 */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-high { background: #dcfce7; color: #166534; }
.badge-medium { background: #fef9c3; color: #854d0e; }
.badge-low { background: #fee2e2; color: #991b1b; }

/* 결제수단 라벨 */
.source-card { color: #0a6666; }
.source-cash { color: #B1888D; }
.source-transfer { color: #6c757d; }

/* 빈 상태 */
.empty-row td {
  text-align: center;
  color: #6c757d;
  padding: 24px;
}

/* 매출매칭 페이지 */
.match-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.match-top-left .table-section,
.match-top-right .table-section {
  height: 100%;
}
.match-top-right .page-empty {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 비교 테이블 상태 */
.status-match {
  color: #0a6666;
  font-weight: 600;
}
.status-mismatch {
  color: #dc3545;
  font-weight: 600;
}
.status-nodata {
  color: #6c757d;
}
.diff-plus { color: #0a6666; }
.diff-minus { color: #dc3545; }

/* 합계 행 */
tfoot td {
  padding: 10px 12px;
  font-weight: 700;
  border-top: 2px solid #0a6666;
  background: #faf8f5;
}

/* 클릭 가능한 행 */
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #e8f4f4 !important; }
.clickable-row.selected { background: #d5eded !important; }

/* 상세 패널 */
.match-top-right .table-section {
  height: 100%;
  overflow-y: auto;
  max-height: 600px;
}
.detail-empty {
  text-align: center;
  color: #6c757d;
  padding: 60px 16px;
  font-size: 14px;
}
.detail-sub-title {
  font-size: 13px;
  font-weight: 700;
  color: #0a6666;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e8e0d8;
}
.detail-table { font-size: 12px; }
.detail-table thead th {
  padding: 7px 10px;
  font-size: 12px;
}
.detail-table tbody td {
  padding: 6px 10px;
}

/* 결제수단 드롭다운 */
.pay-method-select {
  padding: 3px 6px;
  border: 1px solid #CCBEAD;
  border-radius: 4px;
  font-size: 11px;
  font-family: inherit;
  background: #fff;
  cursor: pointer;
}
.pay-method-select:focus {
  outline: none;
  border-color: #0a6666;
}

/* 넘어가기 행 */
.row-skip td {
  opacity: 0.4;
  text-decoration: line-through;
}
.row-skip .pay-method-select {
  opacity: 1;
  text-decoration: none;
}

/* 서비스 셀 줄바꿈 */
.service-cell {
  max-width: 180px;
  word-break: break-all;
}
