:root { --bg: #f4f5f7; --panel: #fff; --line: #e3e5ea; --text: #1d2129; --muted: #6b7280; --blue: #2f6bff; --red: #e5484d; --radius: 8px; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Pretendard", -apple-system, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line); background: #fff; border-radius: var(--radius); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c9ced8; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 5px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=url], input[type=password], input:not([type]), textarea, select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); }
textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.muted { color: var(--muted); }
h2 { font-size: 20px; }

/* 로그인 */
.login { max-width: 360px; margin: 18vh auto; background: #fff; padding: 32px; border-radius: 12px; border: 1px solid var(--line); display: grid; gap: 14px; }

/* 사이트 목록 */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--line); gap: 12px; }
.top .logo { font-weight: 700; font-size: 16px; }
.dash { max-width: 1100px; margin: 28px auto; padding: 0 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 18px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: grid; gap: 8px; }
.card h3 { font-size: 16px; }
.card .row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #eef1f6; color: var(--muted); }
.tag.on { background: #e5f6ea; color: #1a7f37; }

/* 모달 */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: min(640px, 100%); max-height: 90vh; overflow: auto; display: grid; gap: 14px; }
.tpls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl { border: 2px solid var(--line); border-radius: 10px; padding: 14px; cursor: pointer; text-align: left; background: #fff; }
.tpl.on { border-color: var(--blue); background: #f3f6ff; }
.tpl b { display: block; margin-bottom: 4px; }

/* 편집기 */
.editor { display: grid; grid-template-rows: 54px 1fr; height: 100vh; }
.ebar { display: flex; align-items: center; gap: 10px; padding: 0 14px; background: #fff; border-bottom: 1px solid var(--line); }
.ebar .name { font-weight: 700; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ebar .sp { flex: 1; }
.ebar .state { font-size: 12px; color: var(--muted); }
.device { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.device button { border: 0; background: #fff; padding: 6px 10px; cursor: pointer; }
.device button.on { background: #eef2ff; color: var(--blue); }
.ebody { display: grid; grid-template-columns: 260px 1fr 340px; min-height: 0; }
.left, .right { background: #fff; overflow: auto; min-height: 0; }
.left { border-right: 1px solid var(--line); }
.right { border-left: 1px solid var(--line); }
.pane-h { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; font-weight: 700; font-size: 13px; color: var(--muted); }
.list { padding: 0 8px 8px; display: grid; gap: 2px; }
.item { display: flex; align-items: center; gap: 6px; padding: 8px 8px; border-radius: 6px; cursor: pointer; }
.item:hover { background: #f4f6fa; }
.item.on { background: #eef2ff; color: var(--blue); }
.item .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .ops { display: none; gap: 2px; }
.item:hover .ops, .item.on .ops { display: flex; }
.ico { border: 0; background: none; cursor: pointer; padding: 2px 5px; border-radius: 4px; color: var(--muted); font-size: 13px; }
.ico:hover { background: #e7eaf0; color: var(--text); }
.center { min-height: 0; display: flex; justify-content: center; background: #e9ebef; overflow: hidden; }
.center iframe { width: 100%; height: 100%; border: 0; background: #fff; transition: width .2s; }
.center.mobile iframe { width: 390px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }

.props { padding: 4px 14px 30px; display: grid; gap: 12px; }
.field { display: grid; gap: 5px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.img-field { display: grid; grid-template-columns: 64px 1fr; gap: 8px; align-items: center; }
.img-field .thumb { width: 64px; height: 48px; border-radius: 4px; background: #eef0f4 center/cover no-repeat; border: 1px solid var(--line); }
.img-field .acts { display: flex; gap: 4px; }
.sublist { display: grid; gap: 8px; }
.subitem { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 8px; background: #fafbfc; }
.subitem .bar { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.tabs-r { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.tabs-r button { flex: 1; border: 0; background: none; padding: 12px 6px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs-r button.on { color: var(--blue); border-color: var(--blue); font-weight: 600; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.addmenu { display: grid; gap: 4px; padding: 0 8px 12px; }
.addmenu button { text-align: left; border: 1px dashed var(--line); background: #fff; border-radius: 6px; padding: 8px 10px; cursor: pointer; }
.addmenu button:hover { border-color: var(--blue); color: var(--blue); }

/* 신청 내역 */
table.leads { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.leads th, .leads td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 13px; }
.leads th { background: #f7f8fa; color: var(--muted); font-weight: 600; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1d2129; color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; transition: .3s; pointer-events: none; z-index: 200; }
#toast.show { opacity: 1; }

@media (max-width: 1100px) { .ebody { grid-template-columns: 220px 1fr 300px; } }
@media (max-width: 860px) {
  .ebody { grid-template-columns: 1fr; grid-template-rows: auto 50vh auto; overflow: auto; }
  .editor { height: auto; min-height: 100vh; }
  .left, .right { border: 0; }
  .ebar { flex-wrap: wrap; height: auto; padding: 8px; }
}
