/* 샘퐁 제작소 화면 공통 */
@font-face { font-family: 'Pretendard'; font-weight: 400; src: url('../fonts/Pretendard-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Pretendard'; font-weight: 700; src: url('../fonts/Pretendard-Bold.ttf') format('truetype'); }
:root {
  --c: #1a9be0; --c-dark: #137bb4; --c-soft: #e6f4fd; --ink: #1f2933; --muted: #6b7684;
  --line: #e3e8ee; --bg: #f5f8fb; --warn: #b54708; --warn-bg: #fff6e5; --err: #d92d20; --err-bg: #fef0ef;
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; word-break: keep-all; }
a { color: var(--c-dark); }
h1, h2, h3 { margin: 0; line-height: 1.3; }
button, input, textarea, select { font: inherit; color: inherit; }
input[type=text], input[type=password], input[type=number], input[type=date], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 16px;
}
input:focus, textarea:focus { outline: 2px solid var(--c); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; line-height: 1.55; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { background: #f0f4f8; }
.btn.primary { background: var(--c); border-color: var(--c); color: #fff; font-weight: 700; }
.btn.primary:hover { background: var(--c-dark); }
.btn.danger { color: var(--err); }
.btn.small { padding: 5px 10px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 34px; height: 34px; padding: 0; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; flex: none; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; margin-right: auto; }
.topbar .brand img { height: 34px; }
.topbar nav { display: flex; gap: 6px; }

.wrap { max-width: 980px; margin: 0 auto; padding: 24px 20px 60px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 18px; }
.card h2 { font-size: 18px; margin-bottom: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 700; }
.muted { color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 50; max-width: calc(100vw - 32px); }
.toast.err { background: var(--err); }

/* 로그인 */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { width: min(360px, 100%); text-align: center; }
.login img { height: 110px; }
.login h1 { font-size: 22px; margin: 8px 0 20px; }
.login .msg { min-height: 22px; margin-top: 10px; color: var(--err); font-size: 14px; }
.login .btn { width: 100%; margin-top: 12px; padding: 12px; }

/* 새로 만들기 */
.drop { display: block; margin-top: 14px; border: 2px dashed #b9d9ee; border-radius: var(--radius); background: var(--c-soft); padding: 22px; text-align: center; cursor: pointer; }
.drop.over { border-color: var(--c); background: #d6ecfb; }
.drop .filename { margin-top: 6px; font-weight: 700; color: var(--c-dark); }
.or { text-align: center; color: var(--muted); margin: 12px 0; font-size: 13px; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; font-size: 14px; }
.steps span { padding: 4px 10px; border-radius: 999px; background: #eef2f6; color: var(--muted); }
.steps span.now { background: var(--c); color: #fff; }
.steps span.done { background: var(--c-soft); color: var(--c-dark); }
.create-bar { display: flex; justify-content: flex-end; margin-top: 16px; }

/* 보관함 */
.issue-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); }
.issue-row:first-child { border-top: 0; }
.issue-row .info { flex: 1; min-width: 0; }
.issue-row .when { font-weight: 700; }
.issue-row .hint { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue-row .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.empty { color: var(--muted); padding: 20px 0; text-align: center; }

/* 설정 */
.seats-edit { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.seat-col { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fafcfe; min-width: 0; }
.seat-col .col-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 700; }
.seat-item { display: flex; gap: 4px; margin-bottom: 6px; }
.seat-item input { padding: 7px 9px; font-size: 15px; }
.qr-preview { width: 96px; height: 96px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

@media (max-width: 640px) {
  .topbar { padding: 8px 12px; }
  .topbar .brand span { display: none; }
  .wrap { padding: 16px 12px 48px; }
  .card { padding: 16px; }
  .issue-row { flex-direction: column; align-items: stretch; }
  .issue-row .acts { justify-content: flex-start; }
}

/* 손질 화면 */
.subbar { position: sticky; top: 55px; z-index: 15; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.sb-title { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.sb-title b { font-size: 17px; }
.sb-week { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.sb-week input { width: 72px; padding: 6px 8px; }
.sb-acts { display: flex; gap: 6px; flex-wrap: wrap; }
#saveBtn.dirty { box-shadow: 0 0 0 3px #ffd27a; }
.editor { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 20px; padding: 20px; max-width: 1600px; margin: 0 auto; }
.form { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.form .card { margin: 0; }
.form .card + .card { margin-top: 0; }
.form h3 { font-size: 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.form .field + .field { margin-top: 10px; }
.box-warn, .box-memo { border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.box-warn { background: var(--err-bg); color: var(--err); }
.box-memo { background: var(--warn-bg); color: var(--warn); }
.box-warn ul, .box-memo ul { margin: 6px 0 0; padding-left: 18px; }
details.source summary { cursor: pointer; font-weight: 700; }
details.source pre { white-space: pre-wrap; font: 14px/1.6 inherit; font-family: inherit; max-height: 360px; overflow: auto; background: #f7f9fb; padding: 12px; border-radius: 10px; margin: 10px 0 0; }
.list-item { display: flex; gap: 6px; align-items: flex-start; margin-bottom: 8px; }
.list-item textarea, .list-item input { flex: 1; min-width: 0; }
.form textarea { field-sizing: content; min-height: 3.2em; max-height: 60vh; }
.list-item .tools { display: flex; flex-direction: column; gap: 4px; }
.ad-list { display: flex; flex-direction: column; gap: 12px; }
.ad-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fafcfe; }
.ad-card.off { opacity: .65; }
.ad-head { display: flex; gap: 6px; align-items: center; }
.ad-head .no { font-weight: 700; color: var(--c); width: 22px; flex: none; }
.ad-head input { font-weight: 700; }
.guessed { display: inline-block; margin: 6px 0 0 28px; font-size: 12px; background: #fff1c2; color: #8a5a00; border-radius: 999px; padding: 2px 8px; }
.ad-card textarea { margin-top: 8px; }
.ad-opts { display: flex; gap: 8px 14px; flex-wrap: wrap; align-items: center; margin-top: 8px; font-size: 14px; }
.ad-opts label { display: inline-flex; gap: 4px; align-items: center; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumbs figure { margin: 0; position: relative; }
.thumbs img { width: 96px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; background: #fff; }
.thumbs img.qr { width: 64px; object-fit: contain; }
.thumbs figcaption { font-size: 11px; color: var(--muted); text-align: center; }
.thumbs .rm { position: absolute; right: -6px; top: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; cursor: pointer; font-size: 12px; }
.bday-row { display: grid; grid-template-columns: 64px 1fr 84px 34px; gap: 6px; margin-bottom: 6px; }
.bday-row input { padding: 7px 9px; }
.preview { min-width: 0; position: sticky; top: 120px; align-self: start; max-height: calc(100vh - 140px); overflow: auto; background: #e9eef3; border-radius: var(--radius); padding: 12px; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { padding: 7px 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pv-warn:empty { display: none; }
.pv-warn { margin-bottom: 10px; background: var(--err-bg); color: var(--err); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.pv-pane .page-frame { margin: 0 auto 12px; box-shadow: 0 2px 10px rgba(0,0,0,.12); background: #fff; }
.slide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.slide-thumb { background: #fff; border-radius: 10px; padding: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.slide-thumb.dragging { opacity: .4; }
.slide-thumb.drop-before { box-shadow: -4px 0 0 var(--c); }
.slide-thumb .st-bar { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 13px; }
.slide-thumb .st-bar .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.slide-thumb .st-bar .over { color: var(--err); font-weight: 700; }
.slide-thumb .frame { border-radius: 6px; overflow: hidden; cursor: grab; }
.slide-thumb .icon-btn { width: 28px; height: 28px; }
.slide-note { width: 100%; margin-top: 6px; font-size: 13px; padding: 6px 8px; }

@media (max-width: 1000px) {
  .editor { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .subbar { top: 51px; padding: 8px 12px; }
  .preview { position: static; max-height: none; }
}
