/* ============================================================
   editor.css — 수상 데이터 편집기 (진행자/운영자용, 무대 화면 아님)
   ============================================================ */
@font-face {
  font-family: "Pretendard";
  src: url("../assets/fonts/PretendardVariable.woff2") format("woff2-variations");
  font-weight: 45 920; font-display: swap;
}
:root {
  --line: #dde3ec; --line2: #eef2f7;
  --ink: #16202f; --dim: #6b7a90; --soft: #f6f8fb;
  --brand: #1f6feb; --gold: #b5820c; --warn: #b3261e; --ok: #0f7b57;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Pretendard", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink); background: #eef1f6; line-height: 1.5; padding-bottom: 120px;
}
input, select, textarea, button { font: inherit; color: inherit; }

/* ---------- 상단 툴바 ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 12px 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  box-shadow: 0 2px 14px rgba(20,30,50,.06);
}
.bar h1 { font-size: 17px; font-weight: 800; margin-right: 8px; white-space: nowrap; }
.bar .spacer { flex: 1; }
.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 7px 14px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; color: var(--dim); }
.btn.danger { color: var(--warn); border-color: #f0c9c6; }
.btn.sm { padding: 3px 9px; font-size: 12.5px; border-radius: 6px; }
.saved { font-size: 13px; color: var(--ok); font-weight: 600; }
.ver { border: 0; background: none; color: #a7b2c2; font-size: 11.5px; cursor: pointer;
  padding: 4px 6px; white-space: nowrap; }
.ver:hover { color: var(--brand); text-decoration: underline; }

/* ---------- 요약 ---------- */
.summary {
  max-width: 1080px; margin: 20px auto 0; padding: 0 20px;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.chip {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 16px; font-size: 13.5px;
}
.chip b { font-size: 19px; font-weight: 800; margin-right: 5px; }
.chip.warn { border-color: #f0c9c6; background: #fdf4f3; color: var(--warn); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 20px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 18px; }
.panel > h2 {
  font-size: 14px; letter-spacing: .06em; color: var(--dim); font-weight: 700;
  padding: 14px 20px; border-bottom: 1px solid var(--line2);
}
.panel .body { padding: 18px 20px; }

/* ---------- 폼 ---------- */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12.5px; color: var(--dim); font-weight: 600; margin-bottom: 4px; }
input[type=text], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 11px; font-size: 14.5px; background: #fff;
}
input[type=text]:focus, textarea:focus, select:focus { outline: 2px solid #bcd4fb; border-color: var(--brand); }
textarea { resize: vertical; min-height: 46px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.hint { font-size: 12.5px; color: var(--dim); margin-top: 4px; }

/* ---------- 부문 카드 ---------- */
.cat { border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 16px; overflow: hidden; }
.cat > header {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: #f8fafc; border-bottom: 1px solid var(--line2);
}
.cat > header .no {
  width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 800; flex: none;
}
.cat > header .nm { flex: 1; font-weight: 800; font-size: 16px; }
.cat > header .meta { font-size: 12.5px; color: var(--dim); }
.cat .body { padding: 18px 20px; }
.cat.collapsed .body { display: none; }

/* ---------- 템플릿(tier) 선택 ---------- */
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.tier { cursor: pointer; }
.tier input { position: absolute; opacity: 0; pointer-events: none; }
.tier .card {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; height: 100%;
  transition: border-color .12s, background .12s;
}
.tier:hover .card { border-color: #b9c6d8; }
.tier input:checked + .card { border-color: var(--brand); background: #f2f7ff; box-shadow: 0 0 0 3px #dbe8fd; }
.tier .t { font-weight: 800; font-size: 14.5px; }
.tier .d { font-size: 12.5px; color: var(--dim); margin-top: 5px; line-height: 1.45; }
.tier .len { font-size: 12px; color: var(--gold); font-weight: 700; margin-top: 7px; }

/* ---------- 수상팀 표 ---------- */
table.wins { width: 100%; border-collapse: collapse; margin-top: 6px; }
table.wins th {
  font-size: 11.5px; letter-spacing: .06em; color: var(--dim); text-align: left;
  padding: 0 8px 5px; font-weight: 700;
}
table.wins td { padding: 3px 4px; vertical-align: top; }
table.wins td.n { width: 26px; color: var(--dim); font-size: 12px; text-align: right; padding-top: 12px; }
table.wins td.act { width: 92px; white-space: nowrap; padding-top: 7px; }
table.wins input { font-size: 14px; padding: 7px 10px; }
.err { border-color: #e5a09b !important; background: #fdf6f5; }

.rowbtns { display: flex; gap: 5px; }
.iconbtn {
  border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 26px; height: 28px;
  cursor: pointer; font-size: 12px; color: var(--dim); line-height: 1;
}
.iconbtn:hover { background: var(--soft); color: var(--ink); }
.iconbtn.del:hover { color: var(--warn); border-color: #f0c9c6; }

.issues { margin-top: 12px; font-size: 13px; }
.issues div { color: var(--warn); padding: 3px 0; }
.issues div.tip { color: var(--gold); }

.addcat { display: block; width: 100%; padding: 14px; border: 1.5px dashed var(--line);
  border-radius: 12px; background: #fff; color: var(--dim); font-weight: 700; cursor: pointer; }
.addcat:hover { border-color: var(--brand); color: var(--brand); background: #f7fbff; }

/* ---------- 하단 고정 안내 ---------- */
.footnote {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: #16202f; color: #c6d2e2; font-size: 13px; padding: 11px 22px;
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
}
.footnote b { color: #ffd77a; }
@media (max-width: 760px) {
  .grid2, .grid3, .tiers { grid-template-columns: 1fr; }
}

/* ============================================================
   참가팀 명단 · 팀 고르기 · 팝업 (일괄 등록 기능용)
   ============================================================ */
.panel > h2 .cnt { color: var(--brand); font-weight: 800; margin-left: 6px; letter-spacing: 0; }

.toolrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolrow .spacer { flex: 1; }
.toolrow input[type=text] { width: auto; }

.empty {
  border: 1.5px dashed var(--line); border-radius: 10px; padding: 26px;
  text-align: center; color: var(--dim); font-size: 13.5px; line-height: 1.7;
}

/* ---------- 명단 표 ---------- */
table.roster td.badges { padding-top: 11px; }
table.roster tr { cursor: grab; }
table.roster tr.dragging { opacity: .4; }
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; line-height: 1.6;
  padding: 1px 8px; border-radius: 999px; margin: 1px 3px 1px 0;
  background: #eaf1fd; color: #1e5fd0; border: 1px solid #cfe0fa; white-space: nowrap;
}
.badge.none { background: none; border-color: transparent; color: #b3bdcc; }
.badge.miss { background: #fdecea; color: var(--warn); border-color: #f3c9c5; }
td.ro { font-size: 13.5px; padding: 7px 8px !important; color: var(--ink); }

/* ---------- 부문 안의 수상팀 ---------- */
.sechead { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; }
.sechead .lbl { font-size: 12.5px; color: var(--dim); font-weight: 700; }

.drop { border: 1.5px dashed transparent; border-radius: 10px; padding: 2px; transition: .12s; }
.drop.over { border-color: var(--brand); background: #f2f7ff; }
body.dragging-team .drop { border-color: #c6d5e8; }
.dropempty {
  border: 1.5px dashed var(--line); border-radius: 10px; padding: 18px;
  text-align: center; color: var(--dim); font-size: 13px;
}
.wrow {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 12px; margin-bottom: 6px; background: #fff; cursor: grab;
}
.wrow.dragging { opacity: .4; }
.wrow.insert { border-color: var(--brand); box-shadow: 0 -2px 0 var(--brand) inset; }
.wrow.missing { border-color: #f0c9c6; background: #fdf6f5; }
.wrow .grip { color: #c2ccda; font-size: 15px; cursor: grab; }
.wrow .n { color: var(--dim); font-size: 12px; min-width: 16px; }
.wrow .who { flex: 1; min-width: 0; }
.wrow .who .t { font-weight: 700; font-size: 15px; }
.wrow .who .s { font-size: 12.5px; color: var(--dim); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 팝업 ---------- */
body.modal-open { overflow: hidden; }
.modal {
  position: fixed; inset: 0; z-index: 40; display: none;
  background: rgba(16,24,38,.5); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 28px;
}
.modal.on { display: flex; }
.sheet {
  background: #fff; border-radius: 14px; width: min(920px, 96vw);
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 70px rgba(10,18,32,.35);
}
.sheet.narrow { width: min(640px, 96vw); }
.sheet h3 { font-size: 16px; font-weight: 800; padding: 16px 20px; border-bottom: 1px solid var(--line2); }
.sheet .mbody { padding: 16px 20px; overflow: auto; flex: 1; }
.sheet .mfoot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 20px; border-top: 1px solid var(--line2); background: var(--soft);
  border-radius: 0 0 14px 14px;
}
.sheet .mfoot .spacer { flex: 1; }
.sheet .mfoot .cnt { font-size: 13px; color: var(--dim); font-weight: 600; }
.rad { font-size: 13.5px; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

.drop-file { border: 1.5px dashed var(--line); border-radius: 10px; padding: 10px; transition: .12s; }
.drop-file.over { border-color: var(--brand); background: #f2f7ff; }
.drop-file textarea {
  width: 100%; min-height: 150px; border: 0; resize: vertical;
  font-family: ui-monospace, Consolas, monospace; font-size: 13px;
}
.drop-file textarea:focus { outline: none; }
.drop-file .or { font-size: 12.5px; color: var(--dim); padding: 8px 4px 2px; border-top: 1px solid var(--line2); }

#imp-preview { margin-top: 14px; }
#imp-preview .imp-count { font-size: 13.5px; font-weight: 700; color: var(--ok); margin-bottom: 8px; }

/* ---------- 팀 고르기 목록 ---------- */
.picklist { border: 1px solid var(--line); border-radius: 10px; max-height: 46vh; overflow: auto; }
.pick {
  display: flex; align-items: center; gap: 11px; padding: 9px 13px;
  border-bottom: 1px solid var(--line2); cursor: pointer;
}
.pick:last-child { border-bottom: 0; }
.pick:hover { background: var(--soft); }
.pick.on { background: #f2f7ff; }
.pick input { width: 17px; height: 17px; flex: none; }
.pick .who { flex: 1; min-width: 0; }
.pick .who .t { font-weight: 700; font-size: 14.5px; }
.pick .who .s { font-size: 12.5px; color: var(--dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .badges { flex: none; }

/* ---------- 수상팀 / 후보 구분 ---------- */
.sechead.gold {
  border-left: 3px solid #d99a0b; padding-left: 10px; margin-left: -13px;
}
.sechead.gold .lbl { color: #a8730a; font-size: 13.5px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-t {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600;
  padding: 6px 10px 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
}
.chip-t i { font-style: normal; color: #d99a0b; }
.chip-t em {
  font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: #a8730a; background: #fdf3dc; border-radius: 999px; padding: 1px 7px;
}
.chip-t.win { border-color: #e7c983; background: #fffaf0; }
.chip-t .x {
  border: 0; background: none; cursor: pointer; color: #b3bdcc;
  font-size: 12px; padding: 0 2px; line-height: 1;
}
.chip-t .x:hover { color: var(--warn); }
.badge.win { background: #fdf3dc; color: #a8730a; border-color: #e7c983; }

/* ---------- 지난 행사 데이터 경고 ---------- */
.stale-box {
  border: 1px solid #f0c9c6; background: #fdf4f3; border-radius: 10px; padding: 16px 18px;
}
.stale-when { font-size: 13px; font-weight: 700; color: var(--warn); letter-spacing: .02em; }
.stale-title { font-size: 20px; font-weight: 800; margin-top: 6px; }
.stale-sum { font-size: 13.5px; color: var(--dim); margin-top: 4px; }

.saved.stale { color: var(--warn); }
.saved.stale::before {
  content: "⚠ "; font-weight: 800;
}

/* ---------- 처음 온 사람에게 보이는 시작 안내 ---------- */
.welcome { max-width: 1080px; margin: 22px auto 0; padding: 0 20px; }
.welcome .w-inner {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 28px 32px; box-shadow: 0 2px 18px rgba(20,30,50,.05);
}
.welcome h2 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.welcome .w-lead { font-size: 14.5px; color: var(--dim); margin-top: 8px; line-height: 1.6; }
.welcome .w-steps {
  margin: 20px 0 22px; padding-left: 0; list-style: none;
  counter-reset: s; display: grid; gap: 9px;
}
.welcome .w-steps li {
  counter-increment: s; position: relative; padding-left: 36px;
  font-size: 14.5px; line-height: 1.55;
}
.welcome .w-steps li::before {
  content: counter(s); position: absolute; left: 0; top: 1px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand); color: #fff;
  font-size: 12.5px; font-weight: 800;
  display: grid; place-items: center;
}
.welcome .w-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.welcome .w-privacy {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line2);
  font-size: 12.5px; color: var(--dim);
}

/* 연출 템플릿이 15종이 되면서 이름만으로는 성격이 안 잡힙니다.
   분위기 한 단어를 이름 옆에 붙여 훑어보기만 해도 고를 수 있게 합니다. */
.tier .t .mood {
  margin-left: 7px; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  padding: 2px 7px; border-radius: 999px; vertical-align: 2px;
  background: var(--soft); color: var(--dim); border: 1px solid var(--line);
}
.tier input:checked + .card .t .mood { background: #fff; border-color: var(--brand); color: var(--brand); }
