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

body {
  font-family: 'Pretendard', -apple-system, system-ui, sans-serif;
  background: #f5f5f5;
  color: #222;
  line-height: 1.5;
}

header {
  background: #111;
  color: #fff;
  padding: 24px 32px;
}
header h1 { font-size: 20px; font-weight: 700; }
header .subtitle { font-size: 13px; color: #888; margin-top: 2px; }

/* 탭 */
.tabs { margin-top: 12px; display: flex; gap: 4px; }
.tab {
  padding: 6px 16px;
  border: none;
  border-radius: 4px;
  background: #333;
  color: #aaa;
  cursor: pointer;
  font-size: 13px;
}
.tab.active { background: #fff; color: #111; font-weight: 600; }

/* 실시간 */
.live-section { padding: 24px 32px; }
.db-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}
.db-stats .stat-card { flex: 1; }
.live-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.live-controls input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
}
.live-controls select,
.live-controls input[type="date"] {
  padding: 8px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}
.btn-refresh {
  padding: 8px 16px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.btn-refresh:hover { background: #333; }
#live-status { font-size: 13px; color: #666; }
.col-contact { width: 150px; font-size: 12px; }

/* 필터 조건 패널 */
.filter-info {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.filter-info summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.filter-col h4 {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}
.filter-col p {
  font-size: 12px;
  color: #333;
  line-height: 1.6;
}

/* 모달 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}
.modal h2 { font-size: 16px; margin-bottom: 16px; line-height: 1.4; }
.modal-meta { margin-bottom: 16px; }
.modal-meta dt { font-size: 12px; color: #888; margin-top: 10px; }
.modal-meta dd { font-size: 14px; color: #222; margin: 2px 0 0 0; }
.modal-actions { margin-top: 20px; display: flex; gap: 8px; }
.modal-actions a {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  text-decoration: none;
  font-weight: 600;
}
.btn-primary { background: #111; color: #fff; }
.btn-secondary { background: #f0f0f0; color: #333; }
.attachments { margin-top: 12px; }
.attachments a {
  display: block;
  font-size: 13px;
  color: #2563eb;
  margin: 4px 0;
  text-decoration: none;
}
.attachments a:hover { text-decoration: underline; }

/* 클릭 가능한 행 */
#live-tbody tr { cursor: pointer; }
#live-tbody tr:hover { background: #f0f4ff; }

/* 통계 카드 */
.stats {
  display: flex;
  gap: 16px;
  padding: 24px 32px;
}
.stat-card {
  flex: 1;
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  border: 1px solid #e0e0e0;
}
.stat-card.highlight { border-color: #2563eb; }
.stat-card.active { border-color: #16a34a; }
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #111;
}
.stat-card.highlight .stat-value { color: #2563eb; }
.stat-card.active .stat-value { color: #16a34a; }
.stat-label {
  font-size: 13px;
  color: #666;
  margin-top: 4px;
}

/* 필터 */
.controls {
  display: flex;
  gap: 12px;
  padding: 0 32px 16px;
}
.controls input,
.controls select {
  padding: 8px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}
.controls input { flex: 1; }
.controls select { min-width: 120px; }

/* 결과 */
.results {
  padding: 0 32px 32px;
}
.results-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
  color: #666;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
}
thead { background: #fafafa; }
th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  border-bottom: 1px solid #e0e0e0;
}
td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
}
tr:hover { background: #f8f9ff; }

.col-score { width: 50px; text-align: center; }
.col-status { width: 60px; text-align: center; }
.col-title { min-width: 280px; }
.col-org { width: 180px; }
.col-region { width: 50px; text-align: center; font-size: 12px; color: #555; }
.col-budget { width: 100px; text-align: right; }
.col-deadline { width: 110px; }
.col-reasons { width: 200px; }

/* 점수 뱃지 */
.score {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}
.score-high { background: #dcfce7; color: #166534; }
.score-mid { background: #fef3c7; color: #92400e; }
.score-low { background: #f3f4f6; color: #6b7280; }

/* 상태 뱃지 */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.status-active { background: #dcfce7; color: #166534; }
.status-closed { background: #f3f4f6; color: #6b7280; }

.bid-title a {
  color: #111;
  text-decoration: none;
}
.bid-title a:hover { color: #2563eb; text-decoration: underline; }

.reasons {
  font-size: 11px;
  color: #888;
  line-height: 1.4;
}

.budget { font-variant-numeric: tabular-nums; }

/* 페이지네이션 */
.pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 16px;
}
.pagination button {
  padding: 6px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}
.pagination button.active {
  background: #111;
  color: #fff;
  border-color: #111;
}
.pagination button:hover:not(.active) { background: #f0f0f0; }
