:root {
  /* 컴퓨터가 어두운 모드(다크 모드)여도 항상 아래 밝은 색으로만 보이게 고정한다
     (평가자 1,000명 가까이 쓰는 화면이라 사람마다 색이 달라 보이지 않게 하기 위함) */
  color-scheme: light;
  /* 평가자 화면(로그인·비밀번호·내 평가) 배경 — 베이지 */
  --bg: #f7f2ea;
  --surface: #ffffff;
  --text: #1c2733;
  --muted: #5d6b7a;
  --line: #dde3ea;
  /* 포인트 색(버튼·링크·선택 표시) — 올리브그린, 평가자·관리자 화면 공통 */
  --primary: #6b8a52;
  --primary-dark: #566f41;
  --primary-soft: #eaf0e3;
  --accent: #d9822b;
  --ok: #2b7a4b;
  --ok-soft: #e3f3ea;
  --warn: #9a6a00;
  --warn-soft: #fdf1d6;
  --danger: #b3382c;
  --danger-soft: #fbe5e2;
  --gray-soft: #eceff3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 35, 50, .06), 0 2px 8px rgba(20, 35, 50, .05);
  /* 관리자·담당자 화면: 세이지 배경 + 톤온톤 사이드바 (평가자 화면은 이번 범위 아님) */
  --staff-bg: #f3f6f3;
  --sidebar-bg: #5f6b60;
  --sidebar-text: #eef3ee;
}
/* 어두운 모드용 색은 쓰지 않는다 (위 color-scheme: light 로 항상 밝은 모드 고정) */
/* 글꼴: KoPub World 돋움체(한국출판인회의 배포, 무료) — 외부 CDN 없이 파일을 직접 담아서 쓴다
   (인터넷이 느리거나 막힌 곳에서도 그대로 보이고, 보안 정책상 외부 주소를 안 불러오게 하기 위함) */
@font-face {
  font-family: "KoPubWorld Dotum";
  src: url("/fonts/KoPubWorld-Dotum-Light.woff2") format("woff2");
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "KoPubWorld Dotum";
  src: url("/fonts/KoPubWorld-Dotum-Medium.woff2") format("woff2");
  font-weight: 400 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "KoPubWorld Dotum";
  src: url("/fonts/KoPubWorld-Dotum-Bold.woff2") format("woff2");
  font-weight: 600 900; font-style: normal; font-display: swap;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* 스크롤바를 화면에 아예 안 보이게 한다. 내용이 화면보다 길면 마우스 휠·트랙패드로는
   그대로 내릴 수 있고, 막대만 안 보이는 것이다(화면을 깎아내는 게 아니다). */
html { scrollbar-width: none; }
::-webkit-scrollbar { display: none; width: 0; height: 0; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "KoPubWorld Dotum", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  font-size: 15px; line-height: 1.55;
}
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* 상단 바 */
#topbar {
  background: var(--primary); color: #fff; position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding: 8px 16px;
}
#topbar .brand { font-weight: 700; font-size: 17px; margin-right: 8px; color: #fff; text-decoration: none; }
#topbar nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
#topbar nav a {
  color: #dbe7f5; text-decoration: none; padding: 6px 11px; border-radius: 8px; font-size: 14px;
}
#topbar nav a:hover { background: rgba(255,255,255,.14); }
#topbar nav a.active { background: rgba(255,255,255,.22); color: #fff; font-weight: 600; }
#topbar .who { font-size: 13px; color: #dbe7f5; display: flex; gap: 10px; align-items: center; }
#topbar .who button { background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff; padding: 4px 10px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px; }
#topbar .who button:hover { background: rgba(255,255,255,.15); }
.navsep { width: 1px; background: rgba(255,255,255,.3); margin: 4px 6px; }

/* 관리자·담당자: 왼쪽 세로 메뉴 (평가자 화면은 그대로 상단 메뉴를 쓴다) */
body.staff-view { background: var(--staff-bg); }
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 196px; z-index: 20;
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 2px; overflow-y: auto;
}
#sidebar .sb-brand {
  background: none; border: none; color: #fff; font-weight: 700; font-size: 15px; text-align: left;
  padding: 6px 8px 14px; margin-bottom: 6px; cursor: pointer; font: inherit; width: 100%; line-height: 1.3;
  border-bottom: 1px solid rgba(255,255,255,.18);
}
#sidebar .sb-brand:hover { opacity: .85; }
#sidebar nav { display: flex; flex-direction: column; gap: 2px; }
#sidebar a.sb-link {
  display: block; color: var(--sidebar-text); text-decoration: none; padding: 9px 10px; border-radius: 7px; font-size: 14px;
}
#sidebar a.sb-link:hover { background: rgba(255,255,255,.12); }
#sidebar a.sb-link.active { background: rgba(255,255,255,.22); color: #fff; font-weight: 600; }
#sidebar .sb-who { margin-top: auto; font-size: 12px; color: #cfe0d2; padding: 10px 8px 4px; border-top: 1px solid rgba(255,255,255,.18); }
#sidebar .sb-who button {
  display: block; width: 100%; margin-top: 8px; background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff;
  padding: 5px 8px; border-radius: 7px; cursor: pointer; font: inherit; font-size: 12.5px;
}
#sidebar .sb-who button:hover { background: rgba(255,255,255,.15); }
/* 평가 전환 드롭다운 */
.sb-switch { position: relative; }
.sb-switch-menu {
  position: fixed; top: 64px; left: 12px; width: 220px; max-height: 70vh; overflow-y: auto; z-index: 30;
  background: var(--surface); color: var(--text); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.3); padding: 6px;
}
.sb-switch-menu a { display: block; padding: 8px 10px; border-radius: 7px; color: var(--text); text-decoration: none; font-size: 13.5px; }
.sb-switch-menu a:hover { background: var(--gray-soft); }
.sb-switch-menu .muted-chip { font-size: 11px; color: var(--muted); }
body.has-sidebar main#view { margin: 0 0 0 196px; }
@media (max-width: 760px) {
  #sidebar { position: static; width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  #sidebar .sb-who { margin-top: 0; border-top: none; }
  body.has-sidebar main#view { margin: 0; }
}

main { max-width: 1140px; margin: 0 auto; padding: 20px 16px 60px; outline: none; }
body.has-sidebar main { max-width: 980px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.pagehead .grow { flex: 1; min-width: 200px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* 카드·표 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card.tight { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 820px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }
.stat { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stat .num { font-size: 26px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat .lbl { font-size: 13px; color: var(--muted); }

.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--gray-soft); font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; }
tbody tr:hover { background: var(--primary-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

/* 입력 */
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 4px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text);
  font: inherit; min-height: 40px;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.field { margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.row > .field { flex: 1; min-width: 160px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--text); font-size: 14px; margin: 0 0 6px; cursor: pointer; }
.check input { width: 18px; height: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; min-height: 38px; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--gray-soft); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }

/* 배지: 완료(청록)·미제출(테라코타)·마감임박(앰버) — 비슷한 계열의 차분한 톤 */
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--gray-soft); color: var(--muted); white-space: nowrap; }
.chip.blue { background: var(--primary-soft); color: var(--primary-dark); }
.chip.green { background: #e4eef1; color: #3f707f; }
.chip.amber { background: #f5ecd9; color: #a3843a; }
.chip.red { background: #f3e6e1; color: #a2654f; }

/* 진행 막대 */
.bar { height: 10px; border-radius: 999px; background: var(--gray-soft); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.bar.ok > span { background: var(--ok); }

/* 점수 막대 */
.scorebar { position: relative; height: 14px; background: var(--gray-soft); border-radius: 7px; min-width: 120px; }
.scorebar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--primary); border-radius: 7px; }
.scorebar .mark { position: absolute; top: -3px; width: 4px; height: 20px; background: var(--accent); border-radius: 2px; transform: translateX(-2px); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); flex-wrap: wrap; margin: 4px 0 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }
.scoreline { display: flex; align-items: center; gap: 12px; }
.scoreline .val { min-width: 92px; font-variant-numeric: tabular-nums; font-size: 13.5px; }

/* 탭 */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 16px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; font-weight: 600; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* 로그인 */
.authbox { max-width: 400px; margin: 8vh auto 0; }
.authbox .logo { text-align: center; margin-bottom: 18px; }
.authbox .logo b { font-size: 24px; color: var(--primary); }
.notice { padding: 10px 14px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); margin-bottom: 12px; font-size: 14px; }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.notice.info { background: var(--primary-soft); color: var(--primary-dark); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }

/* 평가 입력 */
.evalhead { position: sticky; top: 52px; z-index: 10; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.evalitem { padding: 14px 0; border-top: 1px solid var(--line); }
.evalitem:first-of-type { border-top: none; }
.evalitem .q { font-weight: 500; margin-bottom: 10px; }
.evalitem .q .no { color: var(--muted); margin-right: 6px; font-variant-numeric: tabular-nums; }
/* 문항별 수준표 (문항마다 표 하나, 구분 열 + 수준 열) */
.itemtable { border-collapse: collapse; width: 100%; min-width: 560px; table-layout: fixed; font-size: 13.5px; }
.itemtable th, .itemtable td { border: 1px solid var(--line); padding: 8px 10px; vertical-align: top; }
.itemtable thead th { background: var(--gray-soft); }
.itemtable .itemtable-dim { width: 160px; min-width: 130px; text-align: left; background: var(--surface); white-space: normal; }
.itemtable .itemtable-dim b { font-size: 14px; }
.itemtable th.lvl { width: auto; text-align: center; padding: 0; }
.itemtable .lvl-pick { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 6px; margin: 0; cursor: pointer; }
.itemtable .lvl-pick input { position: absolute; opacity: 0; pointer-events: none; }
.itemtable .lvl-num {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; font-size: 13px;
}
.itemtable .lvl-pick:hover .lvl-num { border-color: var(--primary); }
.itemtable .lvl-pick input:focus-visible + .lvl-num { outline: 2px solid var(--primary); outline-offset: 2px; }
.itemtable th.lvl.sel .lvl-num { background: var(--primary); border-color: var(--primary); color: #fff; }
.itemtable td.lvl-body { text-align: center; color: var(--text); line-height: 1.5; cursor: pointer; }
.itemtable td.lvl-body label { display: block; cursor: pointer; margin: 0; font-weight: 400; color: inherit; }
.itemtable td.lvl-body.sel { background: var(--primary-soft); }
.itemtable td.lvl-body.sel label { color: var(--primary-dark); font-weight: 600; }
.itemtable.locked .lvl-pick, .itemtable.locked td.lvl-body label { cursor: default; }
@media (max-width: 640px) {
  .itemtable { font-size: 13px; }
  .itemtable .itemtable-dim { width: 112px; min-width: 100px; }
  .itemtable th, .itemtable td { padding: 6px 7px; }
}
.evalitem .cm { margin-top: 8px; }
.evalitem.missing { background: var(--danger-soft); border-radius: 8px; padding-left: 10px; padding-right: 10px; }
.secname { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stickybar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 0; margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }

/* 모달·알림 */
#modal-root .backdrop { position: fixed; inset: 0; background: rgba(10, 20, 30, .5); z-index: 50; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 5vh 12px; }
#modal-root .modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 560px; padding: 20px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
#modal-root .modal.wide { max-width: 920px; }
#modal-root .modal h2 { margin-bottom: 14px; }
#modal-root .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; width: calc(100% - 24px); max-width: 480px; pointer-events: none; }
.toast { background: #1c2733; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.3); font-size: 14px; }
.toast.error { background: var(--danger); }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* 양식 편집 */
.seccard { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: var(--surface); }
.itemrow { display: grid; grid-template-columns: 1fr 140px 170px 70px auto; gap: 8px; align-items: start; margin-bottom: 8px; }
@media (max-width: 720px) { .itemrow { grid-template-columns: 1fr 1fr; } .itemrow > :first-child { grid-column: 1 / -1; } }
.itemwrap { margin-bottom: 4px; }
.levels { margin: -2px 0 12px 16px; padding: 8px 12px; border-left: 3px solid var(--primary-soft); }
.levelrow { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.levelrow .lv { flex: 0 0 48px; font-size: 13px; font-weight: 600; color: var(--muted); }
/* 보고서 문구 편집 */
.cmrow { display: grid; grid-template-columns: 100px 100px 1fr auto; gap: 8px; align-items: end; padding: 8px 0; border-top: 1px solid var(--line); }
.cmrow:first-child { border-top: none; }
.cmrow .field { margin: 0; }
@media (max-width: 640px) { .cmrow { grid-template-columns: 1fr 1fr; } .cmrow .grow { grid-column: 1 / -1; } }

/* 개인 결과 보고서 */
.report-nav { margin-bottom: 10px; }
.report { max-width: 860px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; box-shadow: var(--shadow); }
.report-tools { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px dashed var(--line); }
.rp-head { border-bottom: 2px solid var(--primary); padding-bottom: 12px; margin-bottom: 16px; }
.rp-kicker { font-size: 13px; font-weight: 700; color: var(--primary); letter-spacing: .02em; }
.rp-head h1 { margin: 2px 0 10px; }
.rp-info { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 0; font-size: 14px; }
.rp-info div { display: flex; gap: 6px; }
.rp-info dt { color: var(--muted); }
.rp-info dd { margin: 0; font-weight: 600; }
.rp-block { margin-bottom: 20px; break-inside: avoid; page-break-inside: avoid; }
.rp-block h2 { font-size: 17px; border-left: 4px solid var(--primary); padding-left: 8px; }
.rp-scores { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.rp-big { flex: 1; min-width: 160px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.rp-big .num { font-size: 32px; font-weight: 700; color: var(--primary); line-height: 1.15; font-variant-numeric: tabular-nums; }
.rp-big.self .num { color: var(--accent); font-size: 24px; }
.rp-big .lbl { font-size: 13px; }
.rp-comment { background: var(--primary-soft); border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; }
.rp-label { font-size: 12.5px; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.rp-table th, .rp-table td { padding: 7px 10px; }
.rp-sec { padding: 10px 0; border-top: 1px solid var(--line); break-inside: avoid; page-break-inside: avoid; }
.rp-sec:first-of-type { border-top: none; }
.rp-sec-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 4px; }
.rp-sec p { margin: 0; white-space: pre-wrap; }
.rp-foot { margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .report { padding: 16px 14px; } }
.mini-actions { display: flex; gap: 4px; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.comment { border-left: 3px solid var(--primary-soft); padding: 4px 0 4px 12px; margin-bottom: 10px; font-size: 14px; white-space: pre-wrap; }
.comment .src { font-size: 12.5px; color: var(--muted); }

@media (max-width: 640px) {
  main { padding: 14px 12px 50px; }
  #topbar { padding: 8px 12px; position: static; }
  .evalhead { top: 0; }
  th, td { padding: 8px 9px; }
}
@media print {
  /* 화면이 어두운 테마여도 종이에는 밝은 색으로 */
  :root {
    --bg: #fff; --surface: #fff; --text: #111; --muted: #555; --line: #ccd3db;
    --primary: #2f5d8c; --primary-dark: #244a71; --primary-soft: #e9f0f8; --accent: #d9822b; --gray-soft: #eef1f4;
    --shadow: none;
  }
  @page { size: A4; margin: 14mm 12mm; }
  #topbar, .actions, .stickybar, .noprint, #toast-root, #modal-root { display: none !important; }
  html, body { background: #fff; color: #000; }
  main { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  tbody tr:hover { background: none; }
  .report { border: none; box-shadow: none; padding: 0; max-width: none; font-size: 13px; }
  .report h1 { font-size: 20px; }
  .scorebar, .scorebar .fill, .scorebar .mark, .legend i, .rp-comment, th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
