* { box-sizing: border-box; }
body {
  margin: 0; background: #f4f6fa; color: #1e2430;
  font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: 15px; line-height: 1.55;
}
main { max-width: 1080px; margin: 24px auto 80px; padding: 0 16px; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 8px 0 12px; }
h2 { font-size: 18px; margin: 4px 0 12px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
.sub { color: #667085; font-size: 13.5px; }

.topnav {
  display: flex; justify-content: space-between; align-items: center;
  background: #101828; color: #fff; padding: 12px 24px;
}
.topnav a { color: #e5eaf3; margin-left: 18px; }
.topnav .brand { font-weight: 800; font-size: 17px; margin: 0; }

.card {
  background: #fff; border: 1px solid #e4e8f0; border-radius: 12px;
  padding: 20px 24px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(16,24,40,.05);
}
.card.center { text-align: center; padding: 48px 24px; }
.golden-card { border: 1.5px solid #f5c34b; background: #fffdf4; }

.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }

.btn {
  display: inline-block; background: #fff; border: 1px solid #cdd5e1; color: #1e2430;
  border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer;
}
.btn:hover { background: #f0f3f8; text-decoration: none; }
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.primary:hover { background: #1d4fd8; }
.btn.big { font-size: 16px; padding: 12px 22px; width: 100%; margin-top: 6px; }
.btn.small { padding: 3px 9px; font-size: 12.5px; }
.btn.danger { color: #b42318; border-color: #f1c0bb; }
.btn.danger:hover { background: #fef1f0; }

.flash { background: #fff3cd; border: 1px solid #ffe08a; padding: 10px 16px; border-radius: 8px; margin-bottom: 14px; }
.notice { background: #eef4ff; border: 1px solid #c6dbff; padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; }
.errbox { background: #fef1f0; border: 1px solid #f1c0bb; padding: 12px; border-radius: 8px; white-space: pre-wrap; font-size: 13px; }
.empty { text-align: center; padding: 60px 0; color: #667085; }

table.list { width: 100%; border-collapse: collapse; background: #fff; }
table.list th, table.list td { padding: 9px 10px; border-bottom: 1px solid #eef1f6; text-align: left; vertical-align: top; }
table.list thead th { background: #f8fafc; font-size: 13px; color: #475467; white-space: nowrap; }
table.list thead th.sortable { cursor: pointer; user-select: none; }
table.list thead th.sortable:hover { background: #eef2f7; color: #1d4fd8; }
table.list td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.list td.reason { font-size: 13px; color: #475467; }
.table-wrap { overflow-x: auto; }
.row-golden { background: #fffbea; }

table.kv th { text-align: left; padding: 6px 14px 6px 0; color: #475467; white-space: nowrap; vertical-align: top; }
table.kv td { padding: 6px 0; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: #eef1f6; color: #475467; white-space: nowrap; }
.badge.ok { background: #e6f6ec; color: #027a48; }
.badge.err { background: #fef1f0; color: #b42318; }
.badge.run { background: #eef4ff; color: #1d4fd8; }
.badge.promo { background: #fdeee6; color: #b54708; }
.badge.infob { background: #e8f4fd; color: #175cd3; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: #fff; border: 1px solid #f0c94f; border-radius: 999px;
  padding: 6px 14px; font-weight: 600; font-size: 14px;
}
.chip small { color: #98a2b3; font-weight: 400; margin-left: 6px; }
.chip.promo { border-color: #f0a04f; }

form.form label { display: block; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
form.form input, form.form textarea, form.form select {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid #cdd5e1; border-radius: 8px; font-size: 15px; font-family: inherit;
  background: #fff;
}
form.form input:focus, form.form textarea:focus, form.form select:focus {
  outline: 2px solid #93b4f8; border-color: #2563eb;
}
/* 위 display:block 이 hidden 속성(UA의 display:none)을 덮어써서
   드롭존 안의 파일 입력창이 그대로 보이는 문제를 막는다 */
form.form [hidden] { display: none !important; }

.login-box { max-width: 380px; margin: 12vh auto; text-align: center; background: #fff; border: 1px solid #e4e8f0; border-radius: 14px; padding: 40px 32px; }
.login-box input { width: 100%; padding: 12px; margin: 18px 0 12px; border: 1px solid #cdd5e1; border-radius: 8px; font-size: 16px; text-align: center; }
.login-box button { width: 100%; padding: 12px; background: #2563eb; color: #fff; border: 0; border-radius: 8px; font-size: 16px; cursor: pointer; }

.spinner {
  width: 44px; height: 44px; margin: 0 auto 18px;
  border: 4px solid #e4e8f0; border-top-color: #2563eb; border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

ol li { margin-bottom: 6px; }
code { background: #f0f3f8; padding: 1px 6px; border-radius: 5px; font-size: 13px; }

/* ---------- 첨부파일 드래그앤드롭 ---------- */
.dropzone {
  margin-top: 6px; border: 2px dashed #cdd5e1; border-radius: 10px;
  background: #fbfcfe; padding: 22px 16px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus { border-color: #2563eb; background: #f5f8ff; outline: none; }
.dropzone.over { border-color: #2563eb; background: #eaf1ff; }
.dz-icon { font-size: 26px; margin-bottom: 4px; }
.dz-inner div { font-weight: 500; }
.dz-inner .sub { font-weight: 400; margin-top: 4px; }

.filelist { list-style: none; margin: 10px 0 0; padding: 0; }
.filelist li {
  display: flex; align-items: center; gap: 10px; font-weight: 400; font-size: 13.5px;
  background: #f8fafc; border: 1px solid #e4e8f0; border-radius: 8px;
  padding: 7px 12px; margin-bottom: 6px;
}
.filelist li.bad { background: #fef1f0; border-color: #f1c0bb; color: #b42318; }
.filelist .fn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist .fs { color: #667085; white-space: nowrap; }
.filelist .rm {
  border: 0; background: transparent; color: #98a2b3; cursor: pointer;
  font-size: 15px; padding: 0 2px;
}
.filelist .rm:hover { color: #b42318; }

.upload-progress { margin-top: 12px; }
.upload-progress .bar { height: 6px; background: #e4e8f0; border-radius: 99px; overflow: hidden; }
.upload-progress .fill { height: 100%; width: 0; background: #2563eb; transition: width .5s; }
.upload-progress .sub { margin-top: 6px; text-align: center; }

/* ---------- 업체 요약 · 강점약점 · 경쟁사 ---------- */
.overview-card { border-left: 4px solid #2563eb; }
.linklist { list-style: none; margin: 4px 0 0; padding: 0; }
.linklist li { margin-bottom: 5px; word-break: break-all; }
.linklist .badge { margin-right: 6px; }

.notice.warn { background: #fff8e6; border-color: #ffe08a; }

.sw-grid { display: flex; gap: 20px; flex-wrap: wrap; }
.sw-col { flex: 1 1 300px; min-width: 260px; }
.sw-head { margin: 6px 0 8px; font-size: 14px; padding-bottom: 5px; border-bottom: 2px solid #eef1f6; }
.sw-head.good { color: #027a48; border-color: #b7e4c7; }
.sw-head.bad { color: #b42318; border-color: #f1c0bb; }
.sw-list { margin: 0; padding-left: 18px; }
.sw-list li { margin-bottom: 9px; }
.sw-list .sub { margin-top: 2px; }

.comp {
  border: 1px solid #e4e8f0; border-radius: 10px; padding: 16px 18px;
  margin-bottom: 14px; background: #fcfdff;
}
.comp h3 { margin-top: 0; }
.comp h4 { margin: 4px 0 6px; font-size: 13.5px; }
.winpoint {
  margin-top: 12px; background: #eef6ff; border: 1px solid #c6dbff;
  border-radius: 8px; padding: 9px 13px; font-weight: 600; font-size: 14px;
}

/* ---------- 인쇄(PDF 저장) ---------- */
@media print {
  @page { size: A4; margin: 12mm 10mm; }

  body { background: #fff; font-size: 10.5pt; }
  main { max-width: none; margin: 0; padding: 0; }

  /* 화면 전용 요소는 인쇄에서 뺀다 */
  .topnav, .btn, button, form, .flash, .spinner,
  .upload-progress, .dropzone, .filelist { display: none !important; }

  /* 배경색·뱃지 색이 인쇄에서도 살아 있게 */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  a { color: #1e2430; text-decoration: none; }

  .card {
    box-shadow: none; border: 1px solid #d5dbe6; border-radius: 8px;
    padding: 12px 14px; margin-bottom: 12px;
    break-inside: avoid; page-break-inside: avoid;
  }
  /* 키워드/스케줄 표는 길어서 통째로 avoid 하면 오히려 큰 공백이 생긴다 —
     카드는 쪼개되 행·머리글이 잘리지 않게 한다 */
  .card:has(table.list) { break-inside: auto; page-break-inside: auto; }

  h1 { font-size: 16pt; }
  h2 { font-size: 12.5pt; break-after: avoid; page-break-after: avoid; }
  h3 { font-size: 11pt; break-after: avoid; page-break-after: avoid; }

  .table-wrap { overflow: visible !important; }
  table.list { width: 100%; font-size: 8.8pt; border-collapse: collapse; }
  table.list thead { display: table-header-group; }   /* 페이지마다 머리글 반복 */
  table.list tfoot { display: table-footer-group; }
  table.list tr { break-inside: avoid; page-break-inside: avoid; }
  table.list th, table.list td { padding: 4px 6px; }
  table.list td.reason { font-size: 8.2pt; }

  .comp, .sw-col, .golden-card, .chips { break-inside: avoid; page-break-inside: avoid; }
  .sw-grid { display: flex; }

  /* 링크 옆에 실제 주소를 보이게 (종이에서는 클릭이 안 되므로) */
  .linklist a::after { content: ""; }

  /* '확인' 열(네이버 검색환경 버튼)은 인쇄에서 무의미 */
  .kw-table th:last-child, .kw-table td:last-child { display: none; }
}
