/* 홈페이지 수정 도구 — 편집 화면 · 운영 화면 · 초대 화면이 같이 씀
   학원 프로그램 디자인 「심플」 과 같은 값: 옅은 회색 바탕 · 흰 카드 · 파랑 하나 */
:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #1b2130;
  --ink2: #4b5466;
  --muted: #7a8394;
  --line: #e4e8f0;
  --line2: #d3d9e4;
  --blue: #3d5afe;
  --blue-ink: #ffffff;
  --blue-soft: #eef1ff;
  --green: #12805c;
  --green-soft: #e7f6ef;
  --red: #d33a2c;
  --red-soft: #fdeeec;
  --amber: #a15c00;
  --amber-soft: #fff4e0;
  --r: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 28, 48, 0.06), 0 4px 16px rgba(20, 28, 48, 0.05);
  --font: 'Noto Sans KR', system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --fs: 15px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: var(--fs); line-height: 1.55; color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; }
.ico, .ic { display: inline-block; flex: none; line-height: 0; width: 18px; height: 18px; }
.ico svg, .ic svg { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ───── 단추 · 입력 ───── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--card); cursor: pointer; font-weight: 600; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--blue); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--blue-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--blue-soft); border-color: transparent; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 14px; border-radius: 8px; }
.btn-icon { width: 36px; min-height: 36px; padding: 0; }
.btn-block { width: 100%; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.field { display: grid; gap: 6px; margin: 0 0 14px; }
.field > label, .field > .lab { font-weight: 600; font-size: 14px; color: var(--ink2); }
.field .help { font-size: 13px; color: var(--muted); margin: 0; }
.inp, .sel, .area { width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line2); border-radius: 10px; background: #fff; }
.area { min-height: 84px; resize: vertical; line-height: 1.6; }
.inp:focus, .sel:focus, .area:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-soft); }
.inp:disabled, .area:disabled, .sel:disabled { background: #f2f4f8; color: var(--muted); }
.count { font-size: 12px; color: var(--muted); text-align: right; margin-top: -2px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink2); min-height: 36px; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: 99px; background: var(--line2); position: relative; cursor: pointer; flex: none; transition: background 0.15s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
.switch input:checked { background: var(--blue); }
.switch input:checked::after { transform: translateX(18px); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--line2); background: #fff; font-size: 13px; cursor: pointer; color: var(--ink2); }
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--blue-soft); color: var(--blue); white-space: nowrap; }
.pill.gray { background: #eef0f4; color: var(--muted); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }

.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 14px; }
.card h3 { margin: 0 0 10px; font-size: 16px; }
.note { padding: 10px 12px; border-radius: 10px; background: var(--blue-soft); color: #2a3a9c; font-size: 14px; margin: 0 0 14px; }
.note.warn { background: var(--amber-soft); color: #7a4500; }
.note.red { background: var(--red-soft); color: #8e2117; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); }

/* ───── 알림 · 창 ───── */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; background: #1b2130; color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25); font-size: 14px; max-width: calc(100vw - 32px); }
.toast.err { background: var(--red); }
.modal-back { position: fixed; inset: 0; z-index: 90; background: rgba(20, 26, 40, 0.45); display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 18px; width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-head h2 { margin: 0; font-size: 17px; flex: 1; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; }

/* ───── 들어오기 화면 ───── */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.gate .card { width: min(400px, 100%); padding: 26px; }
.gate h1 { font-size: 21px; margin: 0 0 4px; }
.gate .sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.logo-sq { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #3d5afe, #7c4dff); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; flex: none; }

/* ───── 편집 화면 틀 ───── */
.app { display: grid; grid-template-rows: 58px 1fr; height: 100dvh; }
.top { display: flex; align-items: center; gap: 8px; padding: 0 12px; background: #fff; border-bottom: 1px solid var(--line); min-width: 0; }
.top .name { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.top .name b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-state { font-size: 13px; color: var(--muted); white-space: nowrap; }
.save-state.bad { color: var(--red); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; min-height: 36px; padding: 0 12px; cursor: pointer; font-size: 14px; color: var(--ink2); }
.seg button.on { background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.body { display: grid; grid-template-columns: 210px minmax(360px, 440px) 1fr; min-height: 0; }
.nav { background: #fff; border-right: 1px solid var(--line); overflow: auto; padding: 10px 8px 24px; }
.nav button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: none; cursor: pointer; color: var(--ink2); font-size: 14.5px; text-align: left; }
.nav button:hover { background: var(--bg); }
.nav button.on { background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.nav button .ico { width: 20px; height: 20px; flex: none; }
.nav button .pill { margin-left: auto; }
.nav .grp { font-size: 12px; color: var(--muted); padding: 14px 10px 4px; font-weight: 700; }
.panel { overflow: auto; padding: 16px 16px 80px; border-right: 1px solid var(--line); min-width: 0; }
.panel h2 { font-size: 18px; margin: 2px 0 4px; }
.panel .lead { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.stage { display: grid; grid-template-rows: auto 1fr; min-width: 0; min-height: 0; background: #e9edf4; }
.stage-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 13px; color: var(--muted); }
.stage-wrap { position: relative; overflow: hidden; display: flex; justify-content: center; padding: 0 12px 12px; min-height: 0; }
.frame-box { position: relative; background: #fff; box-shadow: 0 6px 28px rgba(20, 28, 48, 0.14); border-radius: 10px; overflow: hidden; width: 100%; height: 100%; transform-origin: top center; }
.frame-box.phone { width: 390px; border-radius: 28px; border: 10px solid #1b2130; max-height: 844px; }
.frame-box iframe { border: 0; width: 100%; height: 100%; display: block; background: #fff; }
.mobile-bar { display: none; }
.only-m { display: none !important; }
@media (max-width: 860px) { .only-m { display: inline-flex !important; } }

/* 칸 목록 */
.secs { display: grid; gap: 6px; margin: 10px 0; }
.sec-row { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 8px 10px; cursor: pointer; min-height: 54px; }
.sec-row:hover { border-color: var(--blue); }
.sec-row.on { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.sec-row.off { opacity: 0.55; }
.sec-row .ico { width: 30px; height: 30px; border-radius: 9px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; flex: none; }
.sec-row .ico svg { width: 17px; height: 17px; }
.sec-row .txt { min-width: 0; flex: 1; display: grid; }
.sec-row .txt b { font-size: 14.5px; }
.sec-row .txt span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-row .acts { display: flex; gap: 2px; flex: none; }
.sec-row .acts .btn { width: 30px; min-height: 30px; padding: 0; border-color: transparent; background: transparent; color: var(--muted); }
.sec-row .acts .btn:hover { background: var(--bg); color: var(--ink); }
.pages { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }

.back { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--blue); cursor: pointer; padding: 6px 0; font-weight: 600; font-size: 14px; }
.variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-bottom: 16px; }
.variant { border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 8px; cursor: pointer; display: grid; gap: 6px; text-align: left; font-size: 13px; color: var(--ink2); }
.variant:hover { border-color: var(--line2); }
.variant.on { border-color: var(--blue); color: var(--blue); font-weight: 700; }
.variant .mini { height: 52px; border-radius: 6px; background: var(--bg); position: relative; overflow: hidden; }
.mini i { position: absolute; background: #c8d0e0; border-radius: 3px; }
.mini i.a { background: var(--blue); opacity: 0.55; }
.fold { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 4px; }
.fold > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink2); padding: 10px 0; list-style: none; }
.fold > summary::before { content: '▸ '; }
.fold[open] > summary::before { content: '▾ '; }

/* 목록 칸(과정 · 선생님 …) */
.items { display: grid; gap: 8px; }
.item { border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
.item-head { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; cursor: pointer; min-height: 44px; }
.item-head b { flex: 1; font-size: 14px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-head .btn { width: 30px; min-height: 30px; padding: 0; border-color: transparent; background: transparent; color: var(--muted); }
.item-head .btn:hover { background: #fff; color: var(--ink); }
.item-body { padding: 4px 12px 2px; border-top: 1px solid var(--line); }

/* 사진 칸 */
.img-pick { display: flex; gap: 10px; align-items: center; }
.img-pick .thumb { width: 84px; height: 64px; border-radius: 10px; background: var(--bg) center/cover no-repeat; border: 1px solid var(--line); flex: none; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.grid-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.grid-photos .ph { position: relative; aspect-ratio: 1; border-radius: 10px; background: var(--bg) center/cover no-repeat; border: 2px solid transparent; cursor: pointer; overflow: hidden; }
.grid-photos .ph.on { border-color: var(--blue); }
.grid-photos .ph .x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.55); color: #fff; cursor: pointer; display: grid; place-items: center; font-size: 13px; }
.grid-photos .ph .cap { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0, 0, 0, 0.6)); color: #fff; font-size: 11px; padding: 10px 6px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upbar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 8px 0; }
.upbar i { display: block; height: 100%; background: var(--blue); width: 0; transition: width 0.2s; }
.drop { border: 2px dashed var(--line2); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }
.drop.over { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }

/* 한눈에 */
.score { display: flex; align-items: center; gap: 16px; }
.ring { --p: 0; width: 86px; height: 86px; border-radius: 50%; background: conic-gradient(var(--blue) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center; flex: none; }
.ring b { width: 68px; height: 68px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 22px; }
.todo { display: grid; gap: 6px; margin-top: 14px; }
.todo-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg); font-size: 14px; }
.todo-row.ok { color: var(--muted); }
.todo-row .pts { font-weight: 700; color: var(--blue); font-size: 13px; width: 36px; flex: none; }
.todo-row.ok .pts { color: var(--green); }
.todo-row span { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.kpi { background: var(--bg); border-radius: 12px; padding: 12px; }
.kpi b { display: block; font-size: 22px; }
.kpi span { font-size: 13px; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.bars i { flex: 1; background: var(--blue); border-radius: 4px 4px 0 0; min-height: 2px; opacity: 0.85; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 13px; }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* 상담 신청 */
.inq { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; display: grid; gap: 6px; }
.inq.new { border-color: var(--blue); }
.inq .who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inq .who b { font-size: 16px; }
.inq .msg { white-space: pre-wrap; background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 14px; }

/* 운영 화면 */
.wrap { max-width: 1080px; margin: 0 auto; padding: 18px 16px 60px; }
.head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.head h1 { font-size: 20px; margin: 0; flex: 1; }
.site-list { display: grid; gap: 10px; }
.site-card { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.site-card .meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* ───── 좁은 화면 ───── */
@media (max-width: 1180px) {
  .body { grid-template-columns: 64px minmax(330px, 400px) 1fr; }
  .nav button span:not(.pill):not(.ico) { display: none; }
  .nav button { justify-content: center; padding: 0; position: relative; }
  .nav button .pill { position: absolute; top: 2px; right: 2px; padding: 0 5px; }
  .nav .grp { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-rows: 54px 1fr auto; }
  .top { padding: 0 8px; gap: 4px; }
  .top .hide-m { display: none !important; }
  .body { display: block; position: relative; overflow: hidden; }
  .nav { position: fixed; z-index: 60; top: 54px; bottom: 0; left: 0; width: min(280px, 82vw); transform: translateX(-100%); transition: transform 0.2s; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2); }
  .nav.open { transform: none; }
  .nav button span:not(.pill):not(.ico) { display: inline; }
  .nav button { justify-content: flex-start; padding: 0 12px; }
  .nav button .pill { position: static; }
  .nav .grp { display: block; }
  .panel { height: 100%; border: 0; padding: 14px 14px 90px; }
  .stage { position: absolute; inset: 0; z-index: 5; }
  .app:not(.show-preview) .stage { display: none; }
  .app.show-preview .panel { visibility: hidden; }
  .frame-box.phone { width: 100%; max-height: none; border: 0; border-radius: 0; box-shadow: none; }
  .stage-wrap { padding: 0; }
  .stage-bar .seg { display: none; }
  .mobile-bar { display: flex; gap: 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); }
  .mobile-bar .btn { flex: 1; }
  .row2 { grid-template-columns: 1fr; }
  .modal-back { padding: 0; align-items: end; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92dvh; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* AI 사진 만들기 */
.btn-ai { background: linear-gradient(135deg, #3d5afe, #8b5cf6); color: #fff; border-color: transparent; }
.btn-ai:hover { filter: brightness(1.06); color: #fff; }
.btn-ai:disabled { opacity: 0.6; }
.ai-entry { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.ai-img { display: grid; gap: 12px; }
.ai-note { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--amber-soft); color: var(--amber); font-size: 13px; line-height: 1.5; }
.ai-gt { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.ai-make { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ai-left { margin: 0; flex: 1 1 220px; }
.ai-cands { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px; }
.ai-cand { width: 100%; border-radius: var(--r-sm); border: 3px solid transparent; background: var(--bg) center/cover no-repeat; cursor: pointer; padding: 0; image-rendering: auto; }
.ai-cand.on { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.ai-cand.wait { cursor: default; background: linear-gradient(90deg, var(--bg), var(--line), var(--bg)); background-size: 200% 100%; animation: aiwait 1.2s linear infinite; }
@keyframes aiwait { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .ai-cand.wait { animation: none; } }
