/* sitehub 관리 화면 — 기능은 공통, 색 · 로고만 병원 스킨 변수 (설계 §8) */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--hub-font); color: var(--hub-ink); background: var(--hub-paper); font-size: 15px; line-height: 1.55; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--hub-brand); }
[hidden] { display: none !important; }
.app.is-loading { visibility: hidden; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 16px; border-radius: var(--hub-radius);
  border: 1px solid var(--hub-line); background: var(--hub-bg); cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--hub-ink); }
.btn:hover { border-color: var(--hub-brand); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: var(--hub-brand); color: var(--hub-brand-ink); border-color: transparent; font-weight: 700; }
.btn--ghost { border-color: transparent; background: none; }
.btn--danger { color: #9B2C2C; }
.btn--sm { min-height: 30px; padding: 0 10px; font-size: 13px; }

/* 로그인 */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--hub-soft); }
.login__box { width: 100%; max-width: 380px; background: var(--hub-bg); border: 1px solid var(--hub-line); border-radius: var(--hub-radius); padding: 32px 28px; display: grid; gap: 14px; }
.login__brand { text-align: center; min-height: 28px; }
.login__brand img { max-width: 220px; height: auto; }
.login__title { margin: 0; font-size: 19px; text-align: center; }
.login label { display: grid; gap: 4px; font-size: 13px; color: var(--hub-ink-2); }
.login input { height: 44px; padding: 0 12px; border: 1px solid var(--hub-line); border-radius: var(--hub-radius); background: #fff; font-size: 15px; color: var(--hub-ink); }
.login__err { margin: 0; min-height: 1.2em; color: #9B2C2C; font-size: 14px; }
.login__note { margin: 0; color: var(--hub-ink-2); font-size: 12px; text-align: center; }
.login .btn { height: 46px; }

/* 틀 */
.shell { min-height: 100vh; display: grid; grid-template-columns: 220px 1fr; grid-template-rows: 60px 1fr; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 20px; background: var(--hub-bg); border-bottom: 1px solid var(--hub-line); position: sticky; top: 0; z-index: 20; }
.top__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 0; }
.top__brand img { height: 30px; width: auto; }
.top__brand small { font-weight: 400; color: var(--hub-ink-2); }
.top__site select { height: 34px; border: 1px solid var(--hub-line); border-radius: var(--hub-radius); padding: 0 8px; background: #fff; max-width: 260px; }
.top__site label { font-size: 13px; color: var(--hub-ink-2); display: flex; gap: 6px; align-items: center; }
.top__user { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--hub-ink-2); }
.top__menu { display: none; border: 0; background: none; font-size: 22px; cursor: pointer; }
.side { background: var(--hub-bg); border-right: 1px solid var(--hub-line); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.side a { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--hub-radius); color: var(--hub-ink); text-decoration: none; }
.side a:hover { background: var(--hub-soft); }
.side a.is-on { background: var(--hub-soft); color: var(--hub-brand); font-weight: 700; }
.side .side__label { font-size: 12px; color: var(--hub-ink-2); padding: 14px 12px 4px; }
.side .count { margin-left: auto; font-size: 12px; background: var(--hub-accent); color: #3A2A00; border-radius: 999px; padding: 0 7px; font-weight: 700; }
.main { padding: 24px; min-width: 0; }
.main h1 { font-size: 21px; margin: 0 0 4px; }
.main .lead { color: var(--hub-ink-2); margin: 0 0 20px; font-size: 14px; }

/* 목록 + 입력 */
.split { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 20px; align-items: start; }
.panel { background: var(--hub-bg); border: 1px solid var(--hub-line); border-radius: var(--hub-radius); padding: 16px; min-width: 0; }
.panel h2 { font-size: 16px; margin: 0 0 12px; }
.panel + .panel { margin-top: 16px; }
.list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.list li { display: flex; align-items: center; gap: 6px; }
.list .item { flex: 1; min-width: 0; text-align: left; border: 1px solid var(--hub-line); background: var(--hub-bg); border-radius: var(--hub-radius); padding: 9px 10px; cursor: pointer; display: grid; gap: 2px; }
.list .item:hover, .list .item.is-on { border-color: var(--hub-brand); }
.list .item.is-on { box-shadow: inset 3px 0 0 var(--hub-brand); }
.list .item b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .item small { color: var(--hub-ink-2); font-size: 12px; }
.list .mv { display: grid; gap: 2px; }
.list .mv button { width: 26px; height: 20px; padding: 0; border: 1px solid var(--hub-line); background: var(--hub-bg); border-radius: 4px; cursor: pointer; font-size: 11px; line-height: 1; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-right: 4px; vertical-align: 1px; }
.badge--DRAFT { background: #ECEFF3; color: #4A5562; }
.badge--PENDING { background: #FFF1CC; color: #7A5200; }
.badge--REVIEWED { background: #DDF3E4; color: #1E6B3A; }
.badge--PUBLISHED { background: var(--hub-brand); color: var(--hub-brand-ink); }
.badge--HIDDEN { background: #F3E3E3; color: #8A2E2E; }
.badge--pin { background: var(--hub-accent); color: #3A2A00; }

.form { display: grid; gap: 14px; }
.form .f { display: grid; gap: 4px; }
.form .f > span { font-size: 13px; color: var(--hub-ink-2); font-weight: 600; }
.form .f small { color: var(--hub-ink-2); font-size: 12px; }
.form input[type=text], .form input[type=number], .form input[type=datetime-local], .form input[type=password], .form select, .form textarea {
  height: 40px; padding: 0 10px; border: 1px solid var(--hub-line); border-radius: var(--hub-radius); background: #fff; width: 100%; min-width: 0; }
.form textarea { height: auto; padding: 10px; }
.form .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.form .inline { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.form .inline label { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }
.form .actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 8px; border-top: 1px solid var(--hub-line-2, var(--hub-line)); }
.state { font-size: 13px; padding: 10px 12px; border-radius: var(--hub-radius); background: var(--hub-soft); color: var(--hub-ink-2); }
.state b { color: var(--hub-ink); }
.editor { border: 1px solid var(--hub-line); border-radius: var(--hub-radius); overflow: hidden; background: #fff; }
.editor iframe { display: block; width: 100% !important; }
.editor__plain { width: 100%; border: 0; padding: 10px; resize: vertical; }
.editor-tools { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }

/* 미리보기 */
.preview { display: grid; grid-template-columns: 1fr 200px; gap: 14px; align-items: start; }
.stage { position: relative; overflow: hidden; border: 1px solid var(--hub-line); border-radius: var(--hub-radius); background:
  repeating-linear-gradient(0deg, transparent 0 39px, rgba(0,0,0,.035) 39px 40px), var(--hub-soft); }
.stage__inner { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.stage--pc { height: 300px; }
.stage--pc .stage__inner { width: 1280px; height: 800px; }
.stage--m { height: 380px; }
.stage--m .stage__inner { width: 375px; height: 700px; }
.stage__label { position: absolute; right: 8px; bottom: 6px; font-size: 11px; color: var(--hub-ink-2); z-index: 2; }
.notice-frame { width: 100%; height: 360px; border: 1px solid var(--hub-line); border-radius: var(--hub-radius); background: #fff; }

/* 표 */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--hub-line); vertical-align: middle; }
.tbl th { font-size: 12px; color: var(--hub-ink-2); font-weight: 600; }
.tbl-wrap { overflow-x: auto; }
code, .code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
pre.code { background: #1F2430; color: #E7E9EE; padding: 14px; border-radius: var(--hub-radius); overflow-x: auto; white-space: pre; margin: 6px 0 14px; }
.once { padding: 12px 14px; border: 2px dashed var(--hub-accent); border-radius: var(--hub-radius); background: #FFFBEA; margin: 10px 0; }
.once code { font-size: 16px; font-weight: 700; user-select: all; }
.empty { color: var(--hub-ink-2); padding: 16px 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #222; color: #fff; padding: 10px 18px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 100; font-size: 14px; max-width: calc(100% - 32px); }
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-err { background: #9B2C2C; }

@media (max-width: 960px) {
  .split, .preview { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 56px auto 1fr; }
  .top { padding: 0 12px; gap: 8px; flex-wrap: wrap; }
  .top__menu { display: block; }
  .top__brand small, #who { display: none; }
  .top__site { order: 5; width: 100%; padding-bottom: 8px; }
  .top { height: auto; min-height: 56px; }
  .side { display: none; border-right: 0; border-bottom: 1px solid var(--hub-line); }
  .side.is-open { display: flex; }
  .main { padding: 16px; }
}

/* 팝업 모양 고르기 */
.pv-h { font-size: 13px; color: var(--hub-ink-2); margin: 4px 0 8px; font-weight: 600; }
.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; margin-bottom: 16px; }
.styles__tile { border: 1px solid var(--hub-line); border-radius: var(--hub-radius); background: var(--hub-bg); padding: 6px; cursor: pointer; display: grid; gap: 4px; font-size: 12px; color: var(--hub-ink-2); }
.styles__tile:hover, .styles__tile.is-on { border-color: var(--hub-brand); color: var(--hub-brand); font-weight: 700; }
.styles__tile.is-on { box-shadow: 0 0 0 2px var(--hub-brand); }
.styles__stage { position: relative; overflow: hidden; aspect-ratio: 520 / 640; background: var(--hub-soft); border-radius: 4px; pointer-events: none; }
.styles__inner { position: absolute; top: 0; left: 0; width: 520px; height: 640px; transform-origin: 0 0; }

/* 전체 배치 */
.stage--layout { margin-top: 4px; }
.stage--layout .hubpop.is-numbered { outline: 3px solid rgba(0, 0, 0, .35); }
.stage--layout .hubpop.is-current { outline: 6px solid var(--hub-accent, #F2B544); z-index: 3; }
.pv-num { position: absolute; top: 8px; left: 8px; width: 44px; height: 44px; border-radius: 50%; background: #222; color: #fff;
  font: 700 24px/44px var(--hub-font); text-align: center; z-index: 5; }
.is-current > .pv-num { background: var(--hub-accent, #F2B544); color: #222; }
.layout-legend { margin: 8px 0 0; padding-left: 0; list-style: none; font-size: 13px; display: grid; gap: 2px; }
.layout-legend li.is-current { color: var(--hub-brand); font-weight: 700; }
.layout-legend small { color: var(--hub-ink-2); font-weight: 400; }
