/* 따뜻한 미색 바탕 + 차분한 초록 포인트 */
:root {
  --main: #2f7a5b;
  --main-dark: #245f47;
  --main-soft: #e8f1ec;
  --ink: #2b2a27;
  --muted: #7d786f;
  --line: #e7e2d9;
  --bg: #f7f4ee;
  --card: #ffffff;
  --field: #faf8f4;
  --warn: #c7790f;
  --warn-soft: #fdf3e2;
  --bad: #d23b3b;
  --bad-soft: #fcebea;
  --ok: #2f7a5b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 50, 30, .05), 0 2px 8px rgba(60, 50, 30, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}
button:hover { border-color: #d6cfc2; background: #fdfcf9; }
button.primary { background: var(--main); border-color: var(--main); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--main-dark); }
button.ghost, .ghost { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; cursor: pointer; }
button.danger { color: var(--bad); }
button.wide { width: 100%; padding: 11px; margin-top: 8px; font-size: 14px; }
.icon-btn { width: 34px; height: 34px; padding: 0; font-size: 16px; }

/* 상단 */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px; background: #fffdf9; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.logo {
  width: 36px; height: 36px; border-radius: 10px; background: var(--main); color: #fff;
  display: grid; place-items: center; flex: none;
}
.title { font-weight: 700; font-size: 16px; }
.sub { color: var(--muted); font-size: 11px; }
.layouts { flex: 1; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.layouts button { border-radius: 999px; padding: 6px 12px; }
.layouts button.on { border-color: var(--main); color: var(--main); background: var(--main-soft); font-weight: 600; }
.top-actions { display: flex; gap: 6px; align-items: center; }
.file-label { display: inline-block; }

/* 본문 */
.layout {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 380px 1fr 330px; gap: 12px; padding: 12px;
}
.panel { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); min-height: 0; box-shadow: var(--shadow); }
.left { display: flex; flex-direction: column; padding: 12px; overflow: auto; }
.right { overflow: auto; padding: 0; background: transparent; border: none; box-shadow: none; display: flex; flex-direction: column; gap: 10px; }
.center { position: relative; overflow: hidden; background: #e4ded5; }
#view3d { position: absolute; inset: 0; }
#view3d canvas { display: block; touch-action: none; }

.tabs { display: flex; gap: 4px; margin-bottom: 10px; background: #f2eee6; padding: 3px; border-radius: 12px; }
.tab { flex: 1; border-radius: 9px; border: none; background: transparent; color: var(--muted); }
.tab:hover { background: rgba(255,255,255,.6); }
.tab.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.tab-body { display: flex; flex-direction: column; gap: 8px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.5; }
h3 { margin: 8px 0 2px; font-size: 13px; }

.plan-wrap { background: #fff; border-radius: 10px; }
#plan { width: 100%; height: auto; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.plan-toolbar {
  align-self: center; display: flex; gap: 6px; align-items: center;
  background: var(--ink); color: #fff; border-radius: 12px; padding: 6px 10px; max-width: 100%;
}
.plan-toolbar button { background: transparent; color: #fff; border-color: #57534c; min-width: 36px; }
.plan-toolbar span { font-weight: 600; margin-right: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
input[type=text], input[type=number], input[type=url], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; background: var(--field); color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(47, 122, 91, .25); border-color: var(--main); }
input[type=color] { width: 100%; height: 33px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.span2 { grid-column: span 2; }
.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.opening {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: grid;
  grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 6px; background: var(--field);
}
.opening .op-head { grid-column: span 3; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }

.drop {
  border: 2px dashed #ddd5c7; border-radius: 12px; padding: 22px; text-align: center; cursor: pointer;
  color: var(--ink); font-size: 13px; background: var(--field);
}
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: zoom-in; }

/* 3D 바 */
.view-bar { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; }
.view-bar #lightMode { margin-left: auto; }
.seg { display: flex; background: rgba(255,253,249,.94); border-radius: 12px; padding: 3px; gap: 2px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.seg button { border: none; background: transparent; border-radius: 9px; padding: 5px 10px; font-size: 12px; }
.seg button.on { background: var(--ink); color: #fff; }
.walk-help {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 5;
  background: rgba(43,42,39,.75); color: #fff; padding: 6px 12px; border-radius: 999px; font-size: 12px; white-space: nowrap;
}

/* 카드 */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.card-h { font-size: 12px; font-weight: 700; color: var(--ink); }
.sel-head { display: flex; gap: 10px; align-items: center; }
.swatch { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); display: inline-block; flex: none; }
.swatch.big { width: 30px; height: 30px; }
.sel-head .swatch { width: 48px; height: 48px; border-radius: 10px; }
.sel-name { font-weight: 700; font-size: 15px; }
.sel-meta { color: var(--muted); font-size: 11px; }
.link { color: var(--main); font-size: 12px; text-decoration: none; font-weight: 600; }

details summary { cursor: pointer; font-size: 12px; color: var(--ink); padding: 4px 0; }
details.paste { background: #f6f2ea; border-radius: 10px; padding: 6px 10px; }
details.paste[open] { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; }
.parse-msg { font-size: 12px; color: var(--main-dark); }
.parse-msg:empty { display: none; }
.parse-msg.bad { color: var(--bad); }
.preset-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; margin-top: 4px; }
.preset-list button { text-align: left; display: flex; justify-content: space-between; gap: 6px; font-size: 12px; }
.preset-list .ps { color: var(--muted); flex: none; }
.preset-group { font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 6px; }

.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.checks li { border-radius: 8px; padding: 7px 9px; font-size: 12px; }
.checks li.warn { background: var(--warn-soft); color: #8a5208; }
.checks li.ok { background: var(--main-soft); color: var(--ok); }
.checks li.bad { background: var(--bad-soft); color: #a52828; }

.shop { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.shop li { display: flex; justify-content: space-between; gap: 6px; align-items: flex-start; }
.shop li > span:first-child { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shop .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop a { color: inherit; }
.shop a.cp { color: var(--main); font-size: 11px; text-decoration: none; }
.shop-total { font-weight: 700; text-align: right; border-top: 1px solid var(--line); padding-top: 6px; }
.disclosure { margin: 0; font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.ad-card { min-height: 120px; }
.site-foot { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; padding: 4px 0 12px; font-size: 11px; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--main); }

/* 품번 불러오기 */
.lookup { display: flex; flex-direction: column; gap: 6px; background: var(--main-soft); border-radius: 12px; padding: 10px; }
.lk-row { display: flex; gap: 6px; }
.lk-row select { width: 76px; flex: none; background: #fff; }
.lk-row input { flex: 1; min-width: 0; background: #fff; }
.lk-row button { flex: none; }
.scan-btn { background: #fff; border: 1px dashed #9cc2b0; color: var(--main-dark); font-weight: 600; padding: 9px; }
.lk-preview { display: flex; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.lk-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; background: #f3efe8; }
.lk-preview > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lk-name { font-weight: 700; font-size: 13px; }
.lk-meta { color: var(--muted); font-size: 11px; }
.lk-dims { font-size: 12px; color: var(--ok); font-weight: 600; }
.lk-dims.bad { color: var(--bad); }
.lk-dims small { color: var(--muted); font-weight: 400; display: block; }
.lk-note { font-size: 11px; color: #8a5208; }
.lk-preview button { align-self: flex-start; margin-top: 4px; padding: 6px 12px; font-size: 12px; }
.lk-results:empty { display: none; }
.lk-results button { align-items: center; }
.lk-results img, .lk-results .noimg { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; flex: none; background: #f3efe8; }
.lk-r-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 모달 */
.modal { position: fixed; inset: 0; background: rgba(30,28,24,.7); z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal[hidden], [hidden] { display: none !important; }
.modal-inner { background: #fff; border-radius: 14px; padding: 10px; max-width: 95vw; max-height: 92vh; display: flex; flex-direction: column; gap: 8px; }
.modal-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.modal-bar > span:first-child { color: var(--muted); margin-right: auto; }
#photoCanvas { max-width: 100%; max-height: 80vh; cursor: crosshair; border-radius: 8px; object-fit: contain; }

/* 바코드 스캔 */
.scan-inner { width: min(520px, 95vw); }
.scan-view { position: relative; background: #111; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame {
  position: absolute; left: 12%; right: 12%; top: 32%; bottom: 32%;
  border: 3px solid rgba(255,255,255,.9); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0,0,0,.35);
}
.scan-msg { font-size: 13px; color: var(--ink); min-height: 18px; }
.scan-inner .row input { flex: 1; min-width: 120px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 999px; z-index: 60; font-size: 13px; max-width: 90vw; text-align: center;
}

.mnav { display: none; }

/* ───── 휴대폰 ───── */
@media (max-width: 900px) {
  body { height: 100dvh; overflow: hidden; }
  .topbar { gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
  .brand { min-width: 0; flex: 1; }
  .title { font-size: 15px; }
  .layouts { order: 3; flex-basis: 100%; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .layouts button { flex: none; padding: 5px 10px; font-size: 12px; }
  .desk-only { display: none; }
  .layout { display: block; padding: 8px; overflow: hidden; position: relative; }
  .layout > .panel { position: absolute; inset: 8px; display: none; }
  body[data-m="plan"] .left,
  body[data-m="view"] .center,
  body[data-m="shop"] .right { display: flex; }
  .right { overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 8px; }
  .center { display: none; }
  body[data-m="view"] .center { display: block; }
  .walk-help { font-size: 11px; bottom: 8px; }
  .seg button { padding: 6px 9px; }
  .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  input[type=text], input[type=number], input[type=url], select, textarea { font-size: 16px; } /* iOS 확대 방지 */
  .lk-row select { width: 72px; }
  .preset-list { max-height: none; }
  .mnav {
    display: flex; background: #fffdf9; border-top: 1px solid var(--line);
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
  }
  .mnav button {
    flex: 1; border: none; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 1px;
    font-size: 11px; color: var(--muted); padding: 6px 0; border-radius: 10px;
  }
  .mnav button span { font-size: 18px; }
  .mnav button.on { color: var(--main); font-weight: 700; background: var(--main-soft); }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* ───── 안내 글 페이지 ───── */
body.docpage { display: block; height: auto; overflow: auto; }
.doc-top { display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: #fffdf9; border-bottom: 1px solid var(--line); }
.doc-top a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.doc-top .cta { margin-left: auto; background: var(--main); color: #fff; padding: 7px 14px; border-radius: 10px; font-size: 13px; }
.doc { max-width: 720px; margin: 0 auto; padding: 24px 18px 48px; font-size: 15px; line-height: 1.75; }
.doc h1 { font-size: 24px; line-height: 1.35; margin: 8px 0 6px; }
.doc .lead { color: var(--muted); margin: 0 0 24px; }
.doc h2 { font-size: 18px; margin: 32px 0 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.doc h3 { font-size: 15px; margin: 18px 0 4px; }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc .tip { background: var(--main-soft); border-radius: 12px; padding: 12px 14px; margin: 14px 0; font-size: 14px; }
.doc .warn { background: var(--warn-soft); border-radius: 12px; padding: 12px 14px; margin: 14px 0; font-size: 14px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 10px 0; }
.doc th, .doc td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
.doc th { background: #f6f2ea; }
.doc a { color: var(--main); }
.doc-foot { max-width: 720px; margin: 0 auto; padding: 0 18px 32px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; }
.doc-foot a { color: var(--muted); text-decoration: none; }

@media (max-width: 900px) {
  /* 평면도가 한 화면에 들어오게 */
  #plan { max-height: calc(100dvh - 330px); width: auto; max-width: 100%; margin: 0 auto; }
  .left .tab-body[data-body="plan"] > .hint { font-size: 11px; }
}

/* ───── 정리된 카드 · 줄 세우기 · 접는 칸 ───── */
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.icon-btn.plain { border: none; background: transparent; color: var(--muted); width: 30px; height: 30px; }
.max-btn { font-size: 15px; }
.seg-btn { background: rgba(255,253,249,.94); border: none; box-shadow: 0 1px 4px rgba(0,0,0,.08); height: 33px; width: 36px; }
.sel-text { flex: 1; min-width: 0; }
.sel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick { display: grid; grid-template-columns: 44px 44px 1fr 1fr; gap: 6px; }
.quick button { padding: 8px 6px; font-size: 13px; }
.multi { background: #f6f2ea; border-radius: 12px; padding: 9px 10px; display: flex; flex-direction: column; gap: 7px; }
.multi-h { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; }
.multi-free { color: var(--muted); font-weight: 400; }
.multi-row { display: flex; gap: 6px; align-items: center; }
.multi-row > button { flex: 1; padding: 8px 6px; }
.stepper { display: flex; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; flex: none; }
.stepper button { border: none; background: transparent; width: 32px; height: 34px; font-size: 16px; padding: 0; }
.stepper span { min-width: 22px; text-align: center; font-weight: 700; }
details.more { border-top: 1px solid var(--line); padding-top: 6px; }
details.more > summary { font-weight: 600; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 6px; padding: 4px 0; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸"; font-size: 11px; transition: transform .15s; }
details.more[open] > summary::before { transform: rotate(90deg); }
details.more[open] { display: flex; flex-direction: column; gap: 8px; }
.lk-qty { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.lk-qty .stepper button { height: 30px; }
.lk-qty > button { margin-top: 0 !important; }

/* ───── 화면 최대화 ───── */
.max-exit {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 40;
  background: var(--ink); color: #fff; border: none; border-radius: 999px; padding: 8px 16px; font-size: 13px;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
}
body[data-max] .topbar, body[data-max] .mnav { display: none !important; }
body[data-max] .layout { display: block !important; padding: 8px; position: relative; height: 100dvh; }
body[data-max] .layout > .panel { display: none !important; }
body[data-max="plan"] .layout > .left,
body[data-max="view"] .layout > .center { display: flex !important; position: absolute; inset: 8px; }
body[data-max="view"] .layout > .center { display: block !important; }
body[data-max="plan"] .left .tab-body[data-body="plan"] { flex: 1; min-height: 0; }
body[data-max="plan"] .plan-wrap { flex: 1; min-height: 0; display: flex; }
body[data-max="plan"] #plan { width: 100%; height: 100%; max-height: none; }
body[data-max] .max-btn { display: none; }
body[data-max="view"] .view-bar { top: 54px; }
/* 최대화 나가기 버튼: 오른쪽 아래 (탭·버튼을 가리지 않게) */
.max-exit { top: auto; left: auto; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); transform: none; }
body[data-max="view"] .view-bar { top: 10px; }
body[data-max="plan"] .plan-toolbar { margin-right: 150px; }

/* ───── 회전 (각도 단위 선택) ───── */
.quick { grid-template-columns: 1fr 1fr; }
.rot { display: flex; align-items: center; gap: 6px; }
.rot-btn { width: 46px; height: 46px; font-size: 22px; padding: 0; flex: none; border-radius: 12px; }
.rot-mid { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rot-val { font-weight: 700; font-size: 15px; }
.rot-steps { display: flex; background: #f2eee6; border-radius: 9px; padding: 2px; gap: 2px; }
.rot-steps button { border: none; background: transparent; padding: 3px 8px; font-size: 12px; border-radius: 7px; color: var(--muted); }
.rot-steps button.on { background: #fff; color: var(--ink); font-weight: 700; box-shadow: var(--shadow); }

/* ───── 확인 창 ───── */
.dlg-inner { width: min(360px, 92vw); padding: 18px; gap: 14px; }
.dlg-title { font-size: 15px; font-weight: 700; line-height: 1.5; }
.dlg-btns { display: flex; gap: 8px; justify-content: flex-end; }
.dlg-btns button { min-width: 80px; padding: 9px 14px; }
button.danger-fill { background: var(--bad); border-color: var(--bad); }
button.danger-fill:hover { background: #b32e2e; }

/* ───── 상품 판정 ───── */
.lk-fit { font-size: 13px; font-weight: 700; padding: 5px 8px; border-radius: 8px; margin-top: 2px; }
.lk-fit.yes { color: var(--ok); background: var(--main-soft); }
.lk-fit.warn { color: #8a5208; background: var(--warn-soft); }
.lk-fit.no { color: #a52828; background: var(--bad-soft); }

/* ───── 휴대폰 앱 화면: 배치 · 상품 추가 · 비교 · 우리 방 ───── */
.mbar, .m-only, #compareCard { display: none; }
@media (max-width: 900px) {
  :root { --nav-h: 60px; }
  .topbar { flex-wrap: nowrap; padding: 7px 10px; }
  .topbar .logo { width: 30px; height: 30px; }
  .title { font-size: 14px; }
  .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand > div:last-child { min-width: 0; }
  .topbar .layouts { display: none; }
  body:not([data-m="view"]) #shotBtn { display: none; }

  body[data-m="plan"] .mbar, body[data-m="view"] .mbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px 0; }
  .mbar .seg { flex: none; box-shadow: none; border: 1px solid var(--line); }
  .m-status { flex: 1; min-width: 0; height: 36px; border-radius: 10px; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-status.ok { color: var(--ok); background: var(--main-soft); border-color: transparent; }
  .m-status.warn { color: #8a5208; background: var(--warn-soft); border-color: transparent; }
  .m-status.bad { color: #a52828; background: var(--bad-soft); border-color: transparent; }
  .mbar .max-btn { flex: none; width: 36px; height: 36px; }
  .view-bar .max-btn, .plan-head, .plan-toolbar { display: none !important; }

  body[data-m="room"] .layout > .left { display: flex; }
  body[data-m="room"] #leftTabs [data-tab="plan"], body[data-m="plan"] #leftTabs { display: none; }
  body[data-m="plan"] .left { padding: 6px; }
  body[data-m="plan"] .left .tab-body[data-body="plan"] { flex: 1; min-height: 0; }
  body[data-m="plan"] .plan-wrap { flex: 1; min-height: 0; display: flex; }
  body[data-m="plan"] #plan { width: 100%; height: 100%; max-height: none; }
  body.has-sel:not([data-max])[data-m="plan"] .layout > .left,
  body.has-sel:not([data-max])[data-m="view"] .layout > .center { bottom: calc(var(--sheet-h, 0px) + 6px); }
  body.has-sel .walk-help { display: none; }

  /* 가구를 고르면 아래에서 올라오는 조작판 */
  body[data-m="plan"] .layout > .right, body[data-m="view"] .layout > .right { display: contents; }
  body[data-m="plan"] .right > *, body[data-m="view"] .right > * { display: none; }
  body[data-m="plan"] #selCard, body[data-m="view"] #selCard {
    display: flex; position: fixed; left: 0; right: 0; z-index: 20; gap: 7px; padding: 9px 12px;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); max-height: 58dvh; overflow-y: auto;
    border-radius: 16px 16px 0 0; border-width: 1px 0 0; box-shadow: 0 -4px 16px rgba(60,50,30,.1);
  }
  #selCard .sel-head .swatch { width: 34px; height: 34px; }
  #selCard .rot-btn { width: 42px; height: 40px; }
  #selCard .rot-mid { flex-direction: row; justify-content: center; gap: 8px; }
  #selCard .rot-steps button { padding: 5px 6px; }
  .m-only { display: block; }
  #selCard .quick { grid-template-columns: repeat(3, 1fr); }
  #selCard .quick button { padding: 7px 4px; }
  #selCard:not(.open) .multi, #selCard:not(.open) details.more { display: none; }

  body[data-m="shop"] .right > :not(#addCard):not(.site-foot) { display: none; }
  body[data-m="compare"] .layout > .right { display: flex; }
  body[data-m="compare"] #selCard, body[data-m="compare"] #addCard { display: none; }
  body[data-m="compare"] #compareCard { display: flex; }
  .right > .card { flex: none; }
  .cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .cmp { border: 1.5px solid var(--line); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
  .cmp.on { border-color: var(--main); background: #fbfdfb; }
  .cmp-map svg { display: block; width: 100%; height: 118px; }
  .cmp-name { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
  .cmp-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cmp-name button { border: none; background: none; color: var(--muted); width: 32px; height: 28px; padding: 0; flex: none; }
  .cmp-tags { display: flex; gap: 3px; flex-wrap: wrap; min-height: 18px; }
  .cmp-tags span { background: var(--main-soft); color: var(--main-dark); border-radius: 6px; padding: 1px 5px; font-size: 10.5px; font-weight: 700; }
  .cmp-st { font-size: 12px; font-weight: 700; }
  .cmp-st.ok { color: var(--ok); } .cmp-st.warn { color: #8a5208; } .cmp-st.bad { color: #a52828; }
  .cmp dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 6px; margin: 0; font-size: 11.5px; }
  .cmp dt { color: var(--muted); } .cmp dd { margin: 0; text-align: right; font-weight: 600; }
  .mnav button { min-width: 0; }
}
@media (max-width: 900px) {
  /* 안내 문구가 아래 조작판을 가리지 않게 위쪽에 표시 */
  .toast { top: calc(100px + env(safe-area-inset-top)); bottom: auto; border-radius: 14px; width: max-content; }
}

/* ───────── 강아지 옷 입혀보기 (dog.html) ───────── */
.dg-link { text-decoration: none; color: var(--ink); font-size: 13px; }
.dg-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr) 360px; grid-template-rows: minmax(0, 1fr); gap: 12px; padding: 12px; }
.dg-left { order: 0; } .dg-stage { order: 1; } .dg-right { order: 2; }
.dg-left .dg-slots { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dg-left .dg-slot-l { font-size: 10.5px; }
.dg-stage { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; padding: 10px; gap: 8px; }
.dg-stage-bar { display: flex; gap: 8px; align-items: center; }
.dg-stage-bar .seg { box-shadow: none; border: 1px solid var(--line); }
.dg-peek { margin-left: auto; user-select: none; -webkit-user-select: none; touch-action: none; }
.dg-canvas-wrap { position: relative; flex: 1; min-height: 260px; background: #efeae2; border-radius: 10px; overflow: hidden; }
#dgCanvas { display: block; touch-action: none; }
.dg-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.dg-upload-btn { display: inline-block; background: var(--main); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; cursor: pointer; }
.dg-guide { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 8px; border-radius: 10px; background: #f6f2ea; }
.dg-guide span { flex: 1; }
.dg-guide.tapping { background: var(--main); color: #fff; font-weight: 700; }
.dg-guide.tapping button { color: var(--ink); }
.dg-op { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.dg-op input { flex: 1; accent-color: var(--main); }
.dg-panel { overflow: auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.dg-panel .card { flex: none; }
.dg-garment-name { font-weight: 400; color: var(--muted); }
.dg-sizes, .dg-garments { display: flex; gap: 6px; flex-wrap: wrap; }
.dg-chip { position: relative; display: flex; align-items: center; gap: 6px; border-radius: 12px; padding: 8px 12px; font-size: 13px; }
.dg-chip b { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-chip.on { border-color: var(--main); background: var(--main-soft); color: var(--main-dark); }
.dg-chip.lv-bad span { color: var(--bad); } .dg-chip.lv-warn span { color: var(--warn); } .dg-chip.lv-good span { color: var(--ok); }
.dg-chip.add { border-style: dashed; color: var(--main-dark); }
.dg-chip.del { color: var(--bad); }
.dg-chip span.dg-best { color: #fff; }
.dg-best { position: absolute; top: -8px; right: -6px; background: var(--main); color: #fff; font-size: 10px; font-weight: 700; border-radius: 6px; padding: 1px 5px; }
.dg-verdict { display: flex; flex-direction: column; gap: 6px; }
.dg-row { display: grid; grid-template-columns: 52px 1fr; gap: 2px 8px; padding: 7px 9px; border-radius: 10px; background: #f7f5f0; font-size: 12.5px; }
.dg-row.lv-bad { background: var(--bad-soft); } .dg-row.lv-warn { background: var(--warn-soft); } .dg-row.lv-good, .dg-row.lv-snug { background: var(--main-soft); }
.dg-k { font-weight: 700; grid-row: span 2; align-self: center; }
.dg-nums { color: var(--muted); }
.dg-res { font-weight: 700; }
.dg-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dg-slot { padding: 0; aspect-ratio: 1; position: relative; overflow: hidden; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: #f6f2ea; }
.dg-slot.on { outline: 2.5px solid var(--main); }
.dg-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dg-plus { font-size: 26px; color: var(--muted); }
.dg-slot-l { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(43,42,39,.7); color: #fff; font-size: 11.5px; padding: 3px 0; }
.dg-howto { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.6; color: var(--ink); }
.dg-thumb { width: 100%; max-height: 220px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.dg-gphoto { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dg-gphoto img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.dg-table-h { font-size: 12px; font-weight: 700; margin-top: 4px; }
.dg-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dg-table th { color: var(--muted); font-weight: 600; text-align: left; padding: 2px 3px; }
.dg-table td { padding: 2px 3px; }
.dg-table input { padding: 6px; }
.dg-table td:last-child { width: 32px; }

@media (max-width: 900px) {
  body.dgpage { height: auto; overflow: auto; display: block; }
  .dg-layout { display: block; padding: 8px; }
  .dg-stage { position: sticky; top: 0; z-index: 10; height: 56dvh; padding: 8px; border-radius: 0 0 16px 16px; margin: -8px -8px 10px; }
  .dg-canvas-wrap { min-height: 0; }
  .dg-guide { padding: 4px 8px; font-size: 12px; }
  .dg-op { font-size: 11px; }
  .dg-panel { overflow: visible; }
  .dgpage .toast { top: calc(56dvh + 10px); }
}

.dg-stage-bar .seg button { padding: 5px 9px; }

/* 3D 예상도 */
.dg-3d { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 35%, #fbf8f3 0%, #ece5da 100%); }
.dg-3d canvas { display: block; touch-action: none; }
.dg-3d-label { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 2; pointer-events: none;
  background: rgba(255,255,255,.92); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 700; white-space: nowrap; max-width: 94%; overflow: hidden; text-overflow: ellipsis; }
.dg-3d-label.lv-bad { color: var(--bad); } .dg-3d-label.lv-warn { color: var(--warn); } .dg-3d-label.lv-good { color: var(--ok); }
#faceCrop { width: 48px; height: 48px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: grab; touch-action: none; flex: none; background: #f3efe8; }

.lk-row select { width: 104px; }
@media (max-width: 900px) { .lk-row select { width: 96px; } }

/* 강아지 옷: 휴대폰은 한 줄로 — 사진 화면 · 사이즈 비교 · 사진 · 치수 · 옷 순서 */
@media (max-width: 900px) {
  .dg-layout { display: flex; flex-direction: column; gap: 10px; }
  .dg-left, .dg-right { display: contents; }
  .dg-stage { order: 0; margin-bottom: 0; }
  #sizeCard { order: 1; } #photoCard { order: 2; } #dogCard { order: 3; } #garmentCard { order: 4; } .dg-right .site-foot { order: 5; }
  .dg-left .dg-slots { gap: 6px; }
}
/* 중간 폭(작은 노트북): 사이즈 비교·옷(위)과 사진·치수(아래)를 왼쪽에 쌓고 오른쪽은 사진 화면 */
@media (min-width: 901px) and (max-width: 1180px) {
  .dg-layout { grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
  .dg-right { grid-column: 1; grid-row: 1; }
  .dg-left { grid-column: 1; grid-row: 2; }
  .dg-stage { grid-column: 2; grid-row: 1 / span 2; }
}

/* 꼬리말 (모든 페이지 공통) */
.site-foot { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; }
.foot-links, .foot-info { display: flex; gap: 4px 12px; flex-wrap: wrap; justify-content: center; }
.foot-info a { color: var(--muted); }
.doc-foot.site-foot { padding: 18px; border-top: 1px solid var(--line); font-size: 12px; }
.doc-foot.site-foot a { color: var(--muted); text-decoration: none; }

/* 꾸밈 글자 로고 */
.logo-word { font-size: 13px; font-weight: 800; letter-spacing: -.02em; text-decoration: none; color: #fff; }
a.logo-word:hover { background: var(--main-dark); }
.doc-top .logo-word { width: 36px; height: 36px; border-radius: 10px; background: var(--main); display: grid; place-items: center; }
.doc-brand { display: flex; flex-direction: column; line-height: 1.25; }
.doc-brand b { font-size: 15px; }
.doc-brand small { font-size: 11px; font-weight: 400; color: var(--muted); }
@media (max-width: 600px) { .doc-brand small { display: none; } }
