/* 사료 입력/상세 공용 스타일 — Digital Hub 디자인 토큰 (Noto Sans KR, #c9171e) */
.saryo-edit {
  font-family: "Noto Sans KR", sans-serif;
  color: #212529;
}

.saryo-edit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 18px;
  margin-bottom: 24px;
}
.saryo-edit-kicker { font-size: 12px; color: #6c757d; letter-spacing: 0.5px; }
.saryo-edit-title { font-size: 24px; font-weight: 700; margin: 4px 0 0; color: #212529; }
.saryo-edit-actions { display: flex; gap: 8px; }

.s-btn {
  font-size: 13.5px; font-weight: 600; font-family: inherit;
  border: none; background: #c9171e; color: #fff;
  padding: 9px 16px; border-radius: 6px; cursor: pointer;
}
.s-btn.ghost { background: #fff; color: #c9171e; border: 1px solid #c9171e; }
.s-btn:disabled { opacity: 0.5; cursor: default; }

.saryo-main { display: flex; gap: 32px; align-items: flex-start; }
.image-col { flex: 0 0 40%; }
.form-col { flex: 1; min-width: 0; }

/* 이미지 업로드 */
.upload {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; width: 100%; height: 300px; cursor: pointer;
  border: 2px dashed #cbd2da; border-radius: 8px; background: #fafbfc; color: #aab2bc;
  overflow: hidden;
}
.upload-plus { font-size: 34px; line-height: 1; }
.upload-hint { font-size: 12px; }
.upload-preview { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.col-note { font-size: 12px; color: #6c757d; margin-top: 12px; line-height: 1.6; }

/* 폼 패널 */
.form-panel {
  background: #fff; border: 1px solid #e9ecef; border-radius: 8px;
  padding: 20px; margin-bottom: 18px;
}
.fld { margin-bottom: 16px; }
.fld:last-child { margin-bottom: 0; }
.flabel {
  display: block; font-size: 11px; font-weight: 600; color: #6c757d;
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}
.flabel .req { color: #c9171e; }
.ctl {
  width: 100%; box-sizing: border-box; border: 1px solid #dee2e6; border-radius: 5px;
  padding: 9px 11px; font-size: 14px; font-family: inherit; color: #212529; background: #fff;
}
.ctl::placeholder { color: #aeb6bf; }
textarea.ctl { resize: vertical; line-height: 1.7; }
.hint { font-size: 11.5px; color: #6c757d; margin-top: 5px; }
.row3 { display: flex; gap: 8px; }
.row3 > .ctl { flex: 1; }
.row3.tight { max-width: 360px; align-items: center; }
.radio { font-size: 13px; color: #39424f; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

.add-row { display: flex; gap: 8px; margin-top: 8px; }
.ctl.narrow { flex: 0 0 130px; }
.s-btn.narrow-btn { flex: 0 0 auto; white-space: nowrap; padding: 8px 12px; }

/* 칩 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 4px; }
.chip {
  font-size: 12.5px; background: #fdecec; color: #c9171e; border: 1px solid #f6c9cb;
  padding: 5px 10px; border-radius: 5px; display: inline-flex; gap: 6px; align-items: center;
}
.chip .chip-x { color: #c98; cursor: pointer; font-weight: 700; }
.chip .chip-x:hover { color: #c9171e; }

/* Autocomplete 드롭다운 */

@media (max-width: 900px) {
  .saryo-main { flex-direction: column; }
  .image-col { flex-basis: auto; width: 100%; }
}

/* ===================== 목록 필터 (T09) ===================== */
.saryo-filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: #f6f6f6; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 12px; margin-bottom: 14px;
}
.saryo-filters .f-ctl {
  border: 1px solid #ccc; border-radius: 6px; padding: 8px 10px; font-size: 13.5px;
  font-family: inherit; background: #fff; color: #333;
}
.saryo-filters .f-ctl#f-q { flex: 1 1 220px; min-width: 180px; }
.saryo-filters .f-ac { position: relative; flex: 0 0 auto; }
.saryo-filters .f-ac .f-ctl { width: 150px; }
.saryo-filters .f-year { width: 110px; }
.saryo-filters .f-tilde { color: #888; }
.saryo-filters .f-selected {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 6px;
  background: #fdecec; color: #c9171e; border: 1px solid #f6c9cb;
  padding: 4px 9px; border-radius: 5px; font-size: 12.5px;
}
.saryo-filters .f-selected .f-clear { cursor: pointer; font-weight: 700; }
.saryo-filters .f-btn {
  border: none; background: #c9171e; color: #fff; padding: 8px 16px; border-radius: 6px;
  cursor: pointer; font-weight: 600; font-size: 13.5px; font-family: inherit;
}
.saryo-filters .f-btn.ghost { background: #fff; color: #c9171e; border: 1px solid #c9171e; }

/* ===================== 목록 (T06) ===================== */
#saryo-table .c-title a { color: #c9171e; text-decoration: none; font-weight: 500; }
#saryo-table .c-title a:hover { text-decoration: underline; }
#saryo-table .c-id, #saryo-table .c-date { white-space: nowrap; color: #6c757d; }

/* ===================== 상세 (T06) ===================== */
.saryo-detail { font-family: "Noto Sans KR", sans-serif; color: #212529; }
.saryo-empty { padding: 60px 0; text-align: center; color: #adb5bd; font-size: 15px; }

.saryo-detail .detail-header {
  padding-bottom: 20px; border-bottom: 1px solid #e9ecef; margin-bottom: 28px;
}
.saryo-detail .data-id { font-size: 12px; color: #6c757d; letter-spacing: 0.5px; }
.saryo-detail .ptitle { font-size: 24px; font-weight: 700; margin: 4px 0 0; }
.saryo-detail .subtitle { font-size: 15px; color: #6c757d; margin-top: 4px; }
/* 제목 + 수정 버튼 (권한 있는 사용자에게만 노출) */
.saryo-detail .detail-title-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.saryo-edit-btn {
  flex: none; margin-top: 6px; padding: 7px 18px; border-radius: 4px;
  background: #c9171e; color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.saryo-edit-btn:hover { background: #a81219; }

/* 목록 헤더 + 신규 등록 버튼 */
.saryo-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.saryo-new-btn {
  flex: none; padding: 9px 18px; border-radius: 4px;
  background: #c9171e; color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.saryo-new-btn:hover { background: #a81219; }

.detail-main { display: flex; gap: 40px; align-items: flex-start; }
.detail-image { flex: 0 0 44%; min-width: 0; }
/* 원문 스캔은 세로로 매우 긴 경우가 있어(두루마리·장문 문서) 높이를 제한한다.
   제한이 없으면 이미지 하나 때문에 페이지 스크롤이 과도하게 길어진다.
   object-fit: contain 이라 잘리지 않고 축소되며, 원본은 클릭해서 새 탭으로 본다. */
.detail-image img {
  width: 100%; max-height: 78vh; object-fit: contain;
  background: #f8f9fa;
  border: 1px solid #dee2e6; border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.detail-image .img-link { display: block; }
.detail-image .img-hint {
  margin-top: 6px; font-size: 12px; color: #8a929c; text-align: right;
}
.detail-image .imgbox {
  width: 100%; height: 260px; border: 1px solid #dee2e6; border-radius: 4px;
  display: flex; align-items: center; justify-content: center; color: #adb5bd;
  background: repeating-linear-gradient(45deg,#f1f3f5,#f1f3f5 12px,#e9ecef 12px,#e9ecef 24px);
}
.detail-image .original-text {
  margin-top: 18px; padding: 20px; background: #f8f9fa; border: 1px solid #dee2e6;
  border-radius: 4px; white-space: pre-wrap; line-height: 1.9; color: #495057; font-size: 14px;
}
.detail-right { flex: 1; min-width: 0; }

.metadata-panel {
  background: #fff; border: 1px solid #e9ecef; border-radius: 6px; padding: 22px; margin-bottom: 28px;
}
.metadata-item { padding: 12px 0; border-bottom: 1px solid #f1f3f5; }
.metadata-item:first-child { padding-top: 0; }
.metadata-item:last-child { padding-bottom: 0; border-bottom: none; }
.metadata-label {
  font-size: 11px; font-weight: 600; color: #6c757d; text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 4px;
}
.metadata-value { font-size: 14px; color: #212529; line-height: 1.5; }
.metadata-value .muted { color: #8a929c; }

.content-sections .dsec { margin-bottom: 26px; }
.content-sections .dsec:last-child { margin-bottom: 0; }
.dsec-title { font-size: 16px; font-weight: 700; margin-bottom: 11px; padding-bottom: 8px; border-bottom: 2px solid #495057; }
.dsec-content { color: #495057; line-height: 1.85; font-size: 14px; white-space: pre-wrap; }
/* 원문·해제처럼 DB 값의 줄바꿈을 살려야 하는 곳은 pre-wrap 을 쓰지만,
   마크업(목록·링크)이 들어가는 섹션은 JSP 들여쓰기 개행까지 그대로 렌더링되어
   빈 줄이 생긴다. 구조화된 내용에는 이 수식 클래스로 pre-wrap 을 해제한다. */
.dsec-content.structured { white-space: normal; }
.dsec-content .link { color: #c9171e; text-decoration: underline; word-break: break-all; }

.keywords { display: flex; flex-wrap: wrap; gap: 8px; }
.keyword {
  background: #fdecec; color: #c9171e; padding: 6px 12px; border-radius: 4px;
  font-size: 13px; font-weight: 600; border: 1px solid #f6c9cb;
}

@media (max-width: 900px) {
  .detail-main { flex-direction: column; }
  .detail-image { flex-basis: auto; width: 100%; }
}

/* 새 인물 등록 요청 모달 (사료 입력 화면) — 목록에 없는 인물을 미확인으로 등록 요청 */
.np-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; overflow-y: auto;
}
.np-overlay[hidden] { display: none; }
.np-modal {
  background: #fff; border-radius: 8px; width: 100%; max-width: 460px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25); font-family: "Noto Sans KR", sans-serif;
}
.np-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #e9ecef; font-size: 15px;
}
.np-close { border: none; background: none; font-size: 18px; cursor: pointer; color: #868e96; padding: 4px 8px; }
.np-close:hover { color: #212529; }
.np-modal-body { padding: 20px; }
.np-grid { display: grid; grid-template-columns: 92px 1fr; gap: 10px 12px; align-items: center; }
.np-grid label { font-size: 12px; font-weight: 600; color: #6c757d; }
.np-grid .req { color: #c9171e; }
.np-note { font-size: 12px; color: #6c757d; margin: 14px 0 0; line-height: 1.6; }
.np-modal-actions {
  display: flex; gap: 8px; justify-content: flex-end; padding: 0 20px 20px;
}
