/* ─────────────────────────────────────────────
 * 자료실 DB 연동 — 카테고리 카드, 검색, 모달
 * ───────────────────────────────────────────── */

.rsr-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.rsr-search {
  flex: 1; min-width: 240px; position: relative;
}
.rsr-search .ic {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); font-size: 13px;
}
.rsr-search input {
  width: 100%; background: #fff; border: 1px solid var(--gray-200);
  border-radius: 10px; padding: 9px 12px 9px 36px;
  font-size: 13px; font-weight: 600; font-family: inherit; color: var(--gray-900);
}
.rsr-search input:focus { outline: none; border-color: var(--primary); }

.rsr-status {
  font-size: 11px; font-weight: 700; color: var(--gray-500);
  margin-bottom: 14px;
}
.rsr-empty, .rsr-loading {
  background: #fff; border: 1px dashed var(--border);
  border-radius: 12px; padding: 32px; text-align: center;
  color: var(--gray-400); font-size: 13px; font-weight: 600;
}
.rsr-empty-inline {
  border: none; padding: 14px; background: transparent;
}

/* ── 카테고리 카드 ─────────────────────── */
.rsr-cat {
  background: #fff;
  border: 1px solid var(--gray-100);
  border-radius: 14px;
  margin-bottom: 14px;
  overflow: hidden;
}
.rsr-cat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--cat-color) 12%, transparent) 0%, #fff 100%);
  border-bottom: 1px solid var(--gray-100);
}
.rsr-cat-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: color-mix(in srgb, var(--cat-color) 18%, transparent);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.rsr-cat-meta { flex: 1; min-width: 0; }
.rsr-cat-name {
  font-size: 15px; font-weight: 900; color: var(--cat-color);
  display: flex; align-items: center; gap: 6px;
}
.rsr-cat-desc {
  font-size: 11px; color: var(--gray-500); font-weight: 600; margin-top: 2px;
}
.rsr-cat-count {
  font-size: 11px; font-weight: 800; color: var(--cat-color);
  background: color-mix(in srgb, var(--cat-color) 15%, transparent);
  padding: 4px 10px; border-radius: 8px; flex-shrink: 0;
}
.rsr-mine {
  font-size: 9px; font-weight: 800; letter-spacing: 0.04em;
  background: var(--primary); color: #fff;
  padding: 2px 6px; border-radius: 4px;
}
.rsr-cat-btn {
  background: #fff; border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px;
  font-size: 12px; cursor: pointer; font-family: inherit;
  transition: all 0.12s; margin-left: 4px;
}
.rsr-cat-btn:hover { background: var(--gray-100); }
.rsr-cat-btn.rsr-danger { color: var(--danger); border-color: var(--danger-100); }
.rsr-cat-btn.rsr-danger:hover { background: var(--danger-50); }

/* ── 항목 그리드 ────────────────────────── */
.rsr-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1px;
  background: var(--gray-100);
}
.rsr-it {
  background: #fff;
  padding: 14px 18px;
  transition: background 0.12s;
}
.rsr-it:hover { background: #FAFBFC; }
.rsr-it-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px; margin-bottom: 6px;
}
.rsr-it-kw {
  font-size: 11px; font-weight: 800; color: var(--cat-color);
}
.rsr-it-updated {
  font-size: 9px; font-weight: 800; color: #fff;
  background: var(--cat-color);
  padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}
.rsr-it-q {
  font-size: 14px; font-weight: 800; margin-bottom: 8px; line-height: 1.4;
  color: var(--gray-900);
}
.rsr-it-a {
  font-size: 12px; color: var(--gray-500); line-height: 1.6;
  font-weight: 500; margin-bottom: 8px;
  padding: 10px; background: var(--gray-50); border-radius: 8px;
  border-left: 3px solid var(--cat-color);
}
.rsr-it-a strong { color: var(--cat-color); font-weight: 800; }
.rsr-it-src {
  font-size: 10px; color: var(--gray-400); font-weight: 700;
}

/* ── 모달 ───────────────────────────────── */
.rsr-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,24,24,0.5); z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: rsrFade 0.15s ease;
}
@keyframes rsrFade { from { opacity: 0; } to { opacity: 1; } }

.rsr-modal-box {
  background: #fff; border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.3);
  width: 100%; max-width: 760px; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.rsr-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--gray-100);
}
.rsr-modal-head h3 {
  margin: 0; font-size: 17px; font-weight: 800; color: var(--gray-900);
}
.rsr-modal-close {
  background: none; border: none; color: var(--gray-400);
  font-size: 26px; line-height: 1; width: 32px; height: 32px;
  border-radius: 8px; cursor: pointer; font-family: inherit;
}
.rsr-modal-close:hover { background: var(--gray-100); color: var(--gray-700); }
.rsr-modal-body {
  padding: 18px 22px 22px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
}
.rsr-row-3 {
  display: grid; grid-template-columns: 100px 110px 1fr; gap: 12px;
}
.rsr-fld { display: flex; flex-direction: column; gap: 6px; }
.rsr-fld > span {
  font-size: 11px; font-weight: 800; color: var(--gray-500); letter-spacing: 0.02em;
}
.rsr-fld input,
.rsr-fld select,
.rsr-fld textarea {
  width: 100%; background: var(--gray-50); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
  font-size: 13px; font-weight: 600; color: var(--gray-900);
  font-family: inherit;
}
.rsr-fld input:focus,
.rsr-fld select:focus,
.rsr-fld textarea:focus { outline: none; background: #fff; border-color: var(--primary); }
.rsr-fld input[type="color"] { padding: 4px; height: 38px; cursor: pointer; }

.rsr-items-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--gray-100);
}
.rsr-items-head strong { font-size: 13px; color: var(--gray-700); }

.rsr-items-list { display: flex; flex-direction: column; gap: 10px; }
.rsr-item-edit {
  background: var(--gray-50); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.rsr-item-edit-head { display: flex; gap: 8px; }
.rsr-item-edit-head input { flex: 1; }
.rsr-item-edit-head input:nth-child(2) { max-width: 110px; }
.rsr-item-edit input,
.rsr-item-edit textarea {
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px;
  font-size: 12px; font-weight: 600; font-family: inherit; color: var(--gray-900);
}
.rsr-item-edit textarea { resize: vertical; min-height: 56px; }
.rsr-item-del {
  background: #fff; border: 1px solid var(--danger-100);
  color: var(--danger); border-radius: 8px;
  width: 30px; height: 30px; padding: 0;
  font-size: 16px; line-height: 1; cursor: pointer; font-family: inherit;
}
.rsr-item-del:hover { background: var(--danger-50); }

.rsr-modal-foot {
  display: flex; gap: 8px; align-items: center; margin-top: 8px;
  padding-top: 14px; border-top: 1px solid var(--gray-100);
}

@media (max-width: 720px) {
  .rsr-row-3 { grid-template-columns: 1fr; }
}
