:root {
  --bg: #f6f5f3; --card: #fff; --ink: #222; --muted: #777; --line: #e4e1dc;
  --accent: #6b4f3a; --accent-ink: #fff; --ok: #2f7d4f; --run: #b7791f; --bad: #c0392b;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif; }
a { color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { font-size: 20px; margin: 0; } h2 { font-size: 17px; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.top nav { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.top nav form { margin: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card.narrow, .login { max-width: 420px; margin: 40px auto; }
.login h1 { margin-bottom: 4px; }
.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--bad); }
.req { color: var(--bad); font-size: 11px; font-weight: 600; }

label { display: block; font-size: 13px; color: #555; margin: 8px 0; }
label.inline { display: inline-flex; align-items: center; gap: 4px; margin: 4px 10px 4px 0; color: var(--ink); }
input, textarea, select { width: 100%; max-width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); margin-top: 3px; }
input[type=checkbox] { width: auto; margin: 0; }
input[type=color] { padding: 2px; height: 36px; }
textarea { resize: vertical; }
button { font: inherit; padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; color: var(--ink); }
button:hover { border-color: #bbb; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { color: var(--bad); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
button:disabled { opacity: .45; cursor: not-allowed; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input { flex: 1 1 220px; margin: 0; }
.row select { width: auto; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.actions .sep { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.right { margin-left: auto; text-align: right; }
fieldset.cats { border: 1px solid var(--line); border-radius: 6px; margin: 10px 0; }
fieldset.cats legend { font-size: 13px; color: #555; }

.tbl { width: 100%; border-collapse: collapse; margin: 8px 0; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 6px; text-align: left; font-size: 14px; }
.tbl td input, .tbl td select { margin: 0; }

.plist { list-style: none; margin: 0; padding: 0; }
.plist li a { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.plist li a:hover { background: #faf9f7; }
.badge { font-size: 12px; padding: 1px 7px; border-radius: 10px; background: #eee; color: #444; white-space: nowrap; }
.badge.ok { background: #e3f3e9; color: var(--ok); } .badge.run { background: #fbf0dc; color: var(--run); } .badge.bad { background: #fbe4e1; color: var(--bad); }
.job { font-size: 13px; font-weight: 400; } .job.running { color: var(--run); } .job.done { color: var(--ok); } .job.error { color: var(--bad); }

.ptitle { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin: 4px 0 10px; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.steps a { font-size: 13px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; text-decoration: none; color: var(--ink); }
.banner { position: sticky; top: 50px; z-index: 4; background: #fff8e6; border: 1px solid #f0d58c; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 8px; }
.thumbs figure { margin: 0; } .thumbs img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 4px; background: #eee; display: block; }
.thumbs figcaption { font-size: 11px; color: var(--muted); }

.shot { border-top: 1px solid var(--line); padding: 12px 0; }
.shead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.refs { display: flex; gap: 6px; align-items: center; margin: 8px 0; overflow-x: auto; }
.refs img { width: 72px; height: 96px; object-fit: cover; border-radius: 4px; display: block; background: #eee; }
.refs .plus { color: var(--muted); font-weight: 700; }
.cands { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 8px 0; }
.cand { margin: 0; border: 2px solid transparent; border-radius: 8px; padding: 4px; cursor: pointer; background: #faf9f7; }
.cand img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 5px; display: block; background: #eee; }
.cand.picked { border-color: var(--accent); background: #f3ece6; }
.cand figcaption { font-size: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.cand .issues { font-size: 12px; color: #6b4b1f; margin: 4px 0 0; }
.regen { margin-top: 6px; }

.colorslots { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.colorslots select { flex: 1 1 140px; min-width: 0; max-width: 100%; }
.preview { max-height: 720px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; margin-top: 12px; text-align: center; background: #fafafa; }
.preview img { width: 100%; max-width: 480px; display: block; margin: 0 auto; }
.check { list-style: none; padding: 0; } .check li::before { content: "✗ "; color: var(--bad); } .check li.ok::before { content: "✓ "; color: var(--ok); }
.okline { font-size: 15px; }
.pwout { background: #fff8e6; padding: 10px; border-radius: 6px; font-family: Consolas, monospace; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #333; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 10; max-width: 90vw; }
#toast.bad { background: var(--bad); }

@media (max-width: 700px) {
  main { padding: 10px; }
  .grid2 { grid-template-columns: 1fr; }
  .cands { grid-template-columns: repeat(2, 1fr); }
  .top nav { gap: 10px; font-size: 13px; }
}

/* ③ 코디 검토 보드 */
.waitline { background: #fff8e6; border: 1px solid #f0d58c; padding: 8px 12px; border-radius: 8px; }
.okline { color: var(--ok); }
.board { border-top: 1px solid var(--line); padding: 12px 0; }
.board-head { font-size: 15px; margin-bottom: 8px; }
.board-imgs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.board-imgs figure { margin: 0; flex: 0 0 170px; }
.board-imgs figcaption { font-size: 12px; color: #555; height: 34px; overflow: hidden; }
.board-imgs img { width: 170px; height: 227px; object-fit: cover; border-radius: 6px; display: block; background: #eee; }
.swap { margin-top: 8px; }
.swap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 8px; }
.swap-item { padding: 4px; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.swap-item img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 4px; }
.swap-item span { font-size: 11px; line-height: 1.3; max-height: 2.6em; overflow: hidden; }
.redo { margin-top: 10px; }
.shotplan { margin-top: 12px; }
@media (max-width: 700px) { .board-imgs figure { flex-basis: 130px; } .board-imgs img { width: 130px; height: 173px; } }
.board-ok { margin: 6px 0 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swap-item.current { border: 2px solid var(--accent); border-radius: 6px; background: #f3ece6; }
#zoomBox { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 20; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
#zoomBox[hidden] { display: none; }
#zoomBox img { max-width: 94vw; max-height: 90vh; object-fit: contain; border-radius: 4px; }
#zoomBox span { position: absolute; top: 14px; right: 18px; color: #fff; font-size: 15px; }

/* ⑤ 사진 칸 고르기 */
#pageEd h3 { font-size: 15px; margin: 16px 0 6px; }
.slotrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.slotrow > b { width: 72px; font-size: 14px; }
.slot { width: 96px; padding: 3px; display: flex; flex-direction: column; gap: 3px; align-items: stretch; border: 2px solid var(--line); border-radius: 8px; background: #fff; }
.slot img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 5px; display: block; }
.slot i { aspect-ratio: 3/4; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 26px; color: #bbb; background: #f6f5f3; border-radius: 5px; }
.slot span { font-size: 11px; color: #555; text-align: center; }
.slot:hover { border-color: var(--accent); }
.slot.empty { border-style: dashed; }
.picker { position: fixed; inset: 0; z-index: 15; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.picker[hidden] { display: none; }
.picker-box { background: #fff; border-radius: 10px; width: min(900px, 100%); max-height: 88vh; overflow: auto; padding: 14px; }
.picker-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; position: sticky; top: -14px; background: #fff; padding: 6px 0; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.pick-opt { padding: 4px; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.pick-opt img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 4px; }
.pick-opt span { font-size: 11px; line-height: 1.3; }
.pick-opt.on { border: 2px solid var(--accent); background: #f3ece6; }
.pick-opt.clear i { aspect-ratio: 3/4; display: flex; align-items: center; justify-content: center; font-style: normal; color: var(--bad); background: #faf6f5; border-radius: 4px; }
.previews { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; margin-top: 12px; }
.previews figure { margin: 0; }
.previews figcaption { font-size: 13px; color: #555; margin-bottom: 4px; }
.gifprev { width: 240px; border-radius: 6px; display: block; }
.previews .preview { width: 480px; max-width: 100%; margin: 0; }
@media (max-width: 700px) { .slot { width: 76px; } .slotrow > b { width: 100%; } }
