/* DIY HOME — interface styles
   Direction: calm, exact, a little warm. World: showroom diorama, birch ply, tracing paper, pencil dimension lines.
   The 3D room is the only rich element; chrome stays on one warm-grey ramp with one walnut accent. */

:root {
  /* neutral ramp, warm graphite */
  --n-0: #ffffff;
  --n-25: #fbfaf8;
  --n-50: #f5f4f1;
  --n-100: #ecebe7;
  --n-200: #dcdad4;
  --n-500: #68635c;
  --n-700: #5c5850;
  --n-900: #1f1d1a;

  --bg-app: var(--n-50);
  --bg-panel: var(--n-25);
  --bg-surface: var(--n-0);
  --bg-hover: var(--n-50);
  --bg-active: var(--n-100);

  --text-1: var(--n-900);
  --text-2: var(--n-700);
  --text-3: var(--n-500);

  --line: rgba(31, 29, 26, 0.08);
  --line-strong: rgba(31, 29, 26, 0.14);

  /* one accent, walnut */
  --accent: #7a4a26;
  --accent-hover: #6a3f1f;
  --accent-soft: rgba(122, 74, 38, 0.08);

  --danger: #b4432f;
  --warn: #925514;
  --ok: #2e6b3e;

  --r-sm: 6px;
  --r-control: 8px;
  --r-card: 12px;
  --r-panel: 16px;

  --font: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --t-fast: 120ms;
  --t-enter: 200ms;

  --shadow-float: 0 1px 2px rgba(31, 29, 26, 0.06), 0 4px 12px rgba(31, 29, 26, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  background: var(--bg-app);
  color: var(--text-1);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hidden { display: none !important; }

/* signature: pencil dimension line */
.dim,
.card-dim-badge,
#selDimensions,
.preview-badge {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.dim::before, .dim::after,
.card-dim-badge::before, .card-dim-badge::after,
#selDimensions::before, #selDimensions::after,
.preview-badge::before, .preview-badge::after {
  content: '';
  width: 8px;
  height: 7px;
  border-left: 1px solid currentColor;
  border-bottom: 0;
  background: linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat;
  opacity: 0.45;
}
.dim::after, .card-dim-badge::after, #selDimensions::after, .preview-badge::after {
  border-left: 0;
  border-right: 1px solid currentColor;
}

/* ───────── top bar ───────── */
.top-bar {
  height: 56px;
  flex: none;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  z-index: 30;
}

.brand-group { display: flex; align-items: center; gap: 8px; }

.brand-logo {
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--text-1);
  border-radius: 4px;
  position: relative;
}
.brand-logo::after {
  /* a cutaway room: floor + two walls */
  content: '';
  position: absolute;
  inset: 5px 5px 5px 5px;
  border-left: 1.5px solid var(--text-1);
  border-bottom: 1.5px solid var(--text-1);
}

.brand-title { font-size: 14px; font-weight: 600; letter-spacing: 0.01em; }

.mode-switcher {
  display: flex;
  gap: 2px;
  background: var(--bg-active);
  padding: 2px;
  border-radius: var(--r-control);
}

.mode-btn {
  border: 0;
  background: transparent;
  height: 28px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.mode-btn:hover { color: var(--text-1); }
.mode-btn.active {
  background: var(--bg-surface);
  color: var(--text-1);
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(31, 29, 26, 0.06);
}

.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }

.tool-btn {
  height: 32px;
  min-width: 32px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  border-radius: var(--r-control);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.tool-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-1); }
.tool-btn:disabled { color: var(--text-3); opacity: 0.5; cursor: not-allowed; }
.tool-btn.labeled { padding: 0 12px; }

.top-sep { width: 1px; height: 20px; background: var(--line-strong); margin: 0 8px; }

.cart-pill {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 4px 0 8px;
  font-variant-numeric: tabular-nums;
}
.cart-count { font-size: 12px; color: var(--text-3); }
.cart-total { font-size: 16px; font-weight: 600; color: var(--text-1); }

/* ───────── workspace ───────── */
.workspace { flex: 1; display: flex; position: relative; overflow: hidden; }

.left-panel,
.right-panel {
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  z-index: 15;
}
.left-panel { width: 296px; border-right: 1px solid var(--line); }
.right-panel { width: 320px; border-left: 1px solid var(--line); overflow-y: auto; }

.workspace.appreciation-mode .left-panel,
.workspace.appreciation-mode .right-panel,
.workspace.appreciation-mode .viewport-hud-top,
.workspace.appreciation-mode .keyboard-shortcuts-bar,
.workspace.appreciation-mode .empty-room-guide,
.workspace.appreciation-mode .floating-status { display: none !important; }

#canvasContainer {
  outline: none;
}
#canvasContainer:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* left: catalog */
.panel-header { padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 12px; }

.panel-title-row { display: flex; justify-content: space-between; align-items: center; }
.panel-title-left { display: flex; align-items: baseline; gap: 8px; }
.panel-title-row h2 { font-size: 14px; font-weight: 600; }

.catalog-sort-select {
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.catalog-sort-select:hover { border-color: var(--text-3); color: var(--text-1); }
.catalog-sort-select:focus { border-color: var(--accent); }

.catalog-count { font-family: var(--mono); font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.panel-desc { display: none; }

.search-box { position: relative; }
.search-box .icon { position: absolute; left: 8px; top: 8px; color: var(--text-3); }
.search-box input {
  width: 100%;
  height: 32px;
  padding: 0 8px 0 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  font-size: 13px;
  background: var(--bg-surface);
  transition: border-color var(--t-fast) var(--ease);
}
.search-box input::placeholder { color: var(--text-3); }
.search-box input:focus { outline: none; border-color: var(--accent); }

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--line);
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.cat-chip:hover { background: var(--bg-hover); color: var(--text-1); }
.cat-chip.active { background: var(--bg-active); color: var(--text-1); }

.cat-chip-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  opacity: 1;
}
.cat-chip.active .cat-chip-count {
  color: var(--text-2);
  opacity: 1;
}

.catalog-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

.product-virtual-spacer {
  width: 100%;
  flex-shrink: 0;
  pointer-events: none;
}

.product-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.product-card {
  padding: 12px 8px;
  border-radius: var(--r-control);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background-color var(--t-fast) var(--ease);
}
.product-card + .product-card { box-shadow: 0 -1px 0 var(--line); }
.product-card:hover, .product-card:hover + .product-card { box-shadow: none; }
.product-card:hover { background: var(--bg-surface); box-shadow: 0 0 0 1px var(--line); }

/* 상품 썸네일 (T-0034: 마크업은 app.js에서 .has-thumb + .card-thumb + .card-body) */
/* 가상 스크롤 itemHeight(106 / 모바일 96)와 카드 높이를 고정으로 맞춤 */
.product-card.has-thumb {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  height: 104px; /* + 리스트 gap 2px = 106 */
  flex: none;
  padding: 8px;
  box-sizing: border-box;
  overflow: hidden;
}
.has-thumb .card-title { line-height: 1.35; }
.has-thumb .card-bottom { margin-top: 0; }
.has-thumb .card-dim-badge,
.has-thumb .stock-status-badge { flex: none; }
.has-thumb .card-brand { flex: 1; }
.has-thumb .card-price { white-space: nowrap; flex: none; }
.room-prod-thumb {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: var(--r-sm);
  object-fit: contain;
  background: var(--n-100);
}
.has-thumb .card-brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-thumb {
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: 8px;
  background: var(--n-100);
  object-fit: contain;
}
.card-thumb.is-missing { visibility: hidden; }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 768px) {
  .product-card.has-thumb { height: 94px; padding: 8px; }
  .card-thumb { width: 56px; height: 56px; }
  .has-thumb .card-title { -webkit-line-clamp: 1; }
}
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-brand { font-size: 12px; color: var(--text-3); }
.card-dim-badge { font-size: 11px; }

.card-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.card-price { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card-actions { display: flex; align-items: center; gap: 8px; }

.swatch-dots { display: flex; gap: 4px; }
.swatch-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(31, 29, 26, 0.16); }

.add-room-btn {
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  background: var(--bg-surface);
  color: var(--text-1);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.product-card:hover .add-room-btn,
.add-room-btn:focus-visible { opacity: 1; }
.add-room-btn:hover { background: var(--bg-hover); }
.add-room-btn:active { transform: scale(0.97); }

.left-footer { padding: 8px; border-top: 1px solid var(--line); }

.full-cta-btn {
  width: 100%;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  border-radius: var(--r-control);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.full-cta-btn:hover { background: var(--bg-hover); color: var(--text-1); }

/* ───────── center stage ───────── */
.center-stage { flex: 1; position: relative; background: var(--n-100); overflow: hidden; }
.canvas-container { width: 100%; height: 100%; }

.viewport-hud-top {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--bg-surface);
  border-radius: var(--r-card);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-float);
  padding: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 10;
  white-space: nowrap;
}

.hud-group { display: flex; align-items: center; gap: 4px; padding: 0 4px; font-size: 12px; color: var(--text-2); }
.hud-group + .hud-group { border-left: 1px solid var(--line); padding-left: 8px; }
.hud-group > label:not(.checkbox-label) { color: var(--text-3); padding-right: 2px; }

.hud-group select {
  height: 28px;
  border: 0;
  background: transparent;
  padding: 0 4px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
}
.hud-group select:hover { background: var(--bg-hover); }

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.checkbox-label:hover { background: var(--bg-hover); }
.checkbox-label input { accent-color: var(--accent); width: 12px; height: 12px; }
.checkbox-label:has(input:checked) { color: var(--text-1); }

.floating-status {
  position: absolute;
  bottom: 12px;
  left: 12px;
  max-width: calc(100% - 24px);
  color: var(--text-2);
  background: rgba(251, 250, 248, 0.92);
  box-shadow: 0 0 0 1px var(--line);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.floating-status strong { font-weight: 500; color: var(--text-1); }
.floating-status.is-collision { color: var(--danger); }

.appreciation-banner {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-float);
  padding: 4px 4px 4px 12px;
  border-radius: var(--r-control);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-2);
  z-index: 25;
}
.appreciation-banner strong { font-weight: 500; color: var(--text-1); }
.appreciation-banner button {
  height: 28px;
  border: 0;
  background: var(--text-1);
  color: var(--n-0);
  font-weight: 500;
  padding: 0 12px;
  border-radius: var(--r-sm);
  transition: background-color var(--t-fast) var(--ease);
}
.appreciation-banner button:hover { background: #33302b; }

/* ───────── right: inspector ───────── */
.inspector-section { padding: 16px; display: flex; flex-direction: column; gap: 24px; }

.inspector-header { display: flex; justify-content: space-between; align-items: center; min-height: 24px; }
.inspector-header h3 { font-size: 14px; font-weight: 600; }

.category-tag { font-size: 12px; color: var(--text-3); }

.icon-close-btn {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.icon-close-btn:hover { background: var(--bg-hover); color: var(--text-1); }
.icon-close-btn:focus-visible { outline: 0; background: var(--bg-active); color: var(--text-1); box-shadow: 0 0 0 1px var(--line-strong); }

/* product block: the second moment */
.sel-head { display: flex; flex-direction: column; gap: 4px; margin-top: -16px; }
.sel-product-name { font-size: 16px; font-weight: 600; line-height: 1.35; }
.sel-brand { font-size: 12px; color: var(--text-3); }

.sel-price-box { display: flex; flex-direction: column; gap: 4px; }
.price-label { display: none; }
.price-value { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }

.spec-grid {
  display: grid;
  grid-template-columns: 72px 1fr;
  row-gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.spec-item { display: contents; }
.spec-k { font-size: 12px; color: var(--text-3); }
.spec-v { font-size: 12px; font-weight: 400; color: var(--text-1); font-variant-numeric: tabular-nums; }
#selDimensions { font-size: 12px; color: var(--text-1); }
#selPositionCoord { font-family: var(--mono); font-size: 11px; color: var(--text-2); }

.buy-link-btn {
  height: 40px;
  border-radius: var(--r-control);
  background: var(--accent);
  color: var(--n-0);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color var(--t-fast) var(--ease);
}
.buy-link-btn:hover { background: var(--accent-hover); }
.buy-link-btn:active { transform: scale(0.99); }

.control-block { display: flex; flex-direction: column; gap: 8px; }

.block-label { font-size: 12px; font-weight: 500; color: var(--text-2); }

.swatch-list { display: flex; flex-wrap: wrap; gap: 4px; }
.swatch-chip {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  background: var(--bg-surface);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.swatch-chip:hover { color: var(--text-1); }
.swatch-chip.active { border-color: var(--text-1); color: var(--text-1); }

.btn-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }

.ctrl-btn {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  background: var(--bg-surface);
  border-radius: var(--r-control);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.ctrl-btn .icon { color: var(--text-2); }
.ctrl-btn:hover { background: var(--bg-hover); }
.ctrl-btn:active { transform: scale(0.98); }
.ctrl-btn.danger { color: var(--danger); }
.ctrl-btn.toggle-btn[aria-pressed="true"] { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); }
.ctrl-btn.danger .icon { color: var(--danger); }
.ctrl-btn.secondary { border-color: transparent; background: transparent; color: var(--text-2); }
.ctrl-btn.secondary:hover { background: var(--bg-hover); color: var(--text-1); }

.slider-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.slider-row input[type='range'] { flex: 1; accent-color: var(--text-1); }
#rotDegLabel { font-family: var(--mono); font-size: 11px; color: var(--text-2); width: 32px; text-align: right; }

.section-sub { display: none; }

.full-select {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--bg-surface);
  font-size: 13px;
}

.dim-inputs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.dim-inputs-grid div { display: flex; flex-direction: column; gap: 4px; }
.dim-inputs-grid span { font-size: 11px; color: var(--text-3); }
.dim-inputs-grid input {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--bg-surface);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.dim-inputs-grid input:focus, .full-select:focus { outline: none; border-color: var(--accent); }

.apply-room-btn {
  height: 32px;
  border: 1px solid var(--line-strong);
  background: var(--bg-surface);
  color: var(--text-1);
  border-radius: var(--r-control);
  font-size: 13px;
  font-weight: 500;
  transition: background-color var(--t-fast) var(--ease);
}
.apply-room-btn:hover { background: var(--bg-hover); }

/* ───────── L-Shape & Room Walls List (T-0014) ───────── */
.l-shape-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-control);
  padding: 8px;
}

.wall-count-badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.room-walls-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.wall-card {
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--bg-surface);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wall-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.wall-info {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.wall-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
}

.wall-length {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
}

.wall-actions {
  display: flex;
  gap: 4px;
}

.wall-mini-btn {
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg-panel);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.wall-mini-btn:hover {
  background: var(--bg-hover);
  color: var(--text-1);
  border-color: var(--text-3);
}

.wall-openings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.opening-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.opening-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.opening-type-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
}

.opening-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.opening-grid-4 div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.opening-grid-4 span {
  font-size: 11px;
  color: var(--text-3);
}
.opening-grid-4 input {
  height: 24px;
  padding: 0 4px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg-surface);
  font-family: var(--mono);
  font-size: 11px;
  width: 100%;
}
.opening-grid-4 input:focus {
  outline: none;
  border-color: var(--accent);
}

.wall-color-row { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.wall-color-row > span { margin-right: 4px; }
.wall-color-row input[type='color'] {
  width: 32px;
  height: 24px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  margin-right: 4px;
}
.wall-color-row .checkbox-label { padding: 0 4px; }

.placed-header-row { display: flex; justify-content: space-between; align-items: baseline; }

.text-btn {
  border: 0;
  background: transparent;
  font-size: 12px;
  color: var(--text-3);
  padding: 0;
  transition: color var(--t-fast) var(--ease);
}
.text-btn:hover { color: var(--text-1); }
.text-btn.danger:hover { color: var(--danger); }

.placed-items-list { display: flex; flex-direction: column; margin: 0 -8px; }

.placed-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--r-control);
  cursor: pointer;
  color: var(--text-3);
  transition: background-color var(--t-fast) var(--ease);
}
.placed-row:hover { background: var(--bg-hover); }
.placed-row > span:last-child { font-size: 0; }
.placed-row > span:last-child::after {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-3);
  border-top: 1.5px solid var(--text-3);
  transform: rotate(45deg);
}
.placed-row-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.placed-row-name { font-size: 13px; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.placed-row-sub { font-family: var(--mono); font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ───────── converter modal ───────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(31, 29, 26, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 32px;
}

.converter-studio {
  width: min(1120px, 100%);
  max-height: 100%;
  background: var(--bg-panel);
  border-radius: var(--r-panel);
  box-shadow: 0 0 0 1px var(--line), 0 16px 48px rgba(31, 29, 26, 0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-in var(--t-enter) var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(4px); } }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-header p { font-size: 13px; color: var(--text-2); margin-top: 4px; max-width: 640px; }

.converter-body { display: grid; grid-template-columns: 1fr 400px; overflow: hidden; flex: 1; min-height: 0; }

.converter-form { padding: 20px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.form-group input,
.form-group select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--bg-surface);
  font-size: 13px;
  width: 100%;
}
.form-group input[type='color'] { padding: 2px; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--accent); }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.image-upload-box {
  position: relative;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-card);
  background: var(--bg-surface);
  padding: 16px;
  transition: border-color var(--t-fast) var(--ease);
}
.image-upload-box:hover { border-color: var(--text-3); }
.image-upload-box input[type='file'] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.upload-preview-row { display: flex; align-items: center; gap: 12px; }
#convPreviewImg { width: 64px; height: 64px; object-fit: cover; border-radius: var(--r-control); }
#convUploadHint { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
#convUploadHint strong { font-weight: 500; }
#convUploadHint span { font-size: 12px; color: var(--text-3); }

.converter-preview-pane {
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
  background: var(--bg-app);
}

.preview-canvas-wrap {
  flex: 1;
  min-height: 320px;
  position: relative;
  border-radius: var(--r-card);
  background: var(--n-100);
  overflow: hidden;
}
.preview-canvas-wrap canvas { display: block; }
.preview-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(251, 250, 248, 0.92);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  z-index: 2;
}

.converter-actions { display: flex; flex-direction: column; gap: 4px; }

.primary-cta-btn {
  height: 40px;
  border: 0;
  border-radius: var(--r-control);
  background: var(--accent);
  color: var(--n-0);
  font-size: 14px;
  font-weight: 500;
  transition: background-color var(--t-fast) var(--ease);
}
.primary-cta-btn:hover { background: var(--accent-hover); }
.primary-cta-btn:active { transform: scale(0.99); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* T-0002: placement location */
#selPlacementLocation { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==========================================================================
   Mobile Web Responsive (≤ 768px) — T-0010
   - Bottom sheet for Catalog (#leftPanel) and Inspector (#rightPanel)
   - Top bar: Logo, Mode switcher, Cart summary pill only
   - Canvas occupies >= 60% of viewport height
   - Touch targets >= 40x40px
   - Desktop (>= 1024px) remains 100% pixel-identical
   ========================================================================== */

.sheet-handle-bar,
.mobile-bottom-nav,
.mobile-hud-trigger,
.mobile-hud-header {
  display: none;
}

@media (max-width: 768px) {
  /* 1. Global top bar */
  .top-bar {
    height: 56px;
    padding: 0 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .brand-group {
    gap: 8px;
    flex-shrink: 0;
  }
  .brand-title {
    font-size: 13px;
  }

  .mode-switcher {
    gap: 2px;
    padding: 2px;
  }
  .mode-btn {
    height: 40px;
    min-height: 40px;
    min-width: 44px;
    padding: 0 12px;
    font-size: 12px;
    gap: 4px;
  }

  /* Hide non-essential top tools on mobile */
  #btnOpenConverter,
  .top-sep,
  #btnUndo,
  #btnRedo,
  #btnResetCamera,
  #btnScreenshot {
    display: none !important;
  }

  #btnOpenTemplates span {
    display: none;
  }

  #btnOpenTemplates,
  #btnShareRoom {
    min-width: 36px;
    padding: 0 8px;
    display: inline-flex !important;
  }

  .top-actions {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
  }

  .cart-pill {
    min-height: 40px;
    padding: 0 4px;
    align-items: center;
    gap: 4px;
  }
  .cart-count {
    display: none;
  }
  .cart-total {
    font-size: 14px;
  }

  /* 2. Workspace & 3D Center Stage */
  .workspace {
    position: relative;
    width: 100%;
    height: calc(100vh - 56px);
    overflow: hidden;
    display: block;
  }

  .center-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
  }

  .canvas-container {
    width: 100%;
    height: 100%;
  }

  .canvas-container canvas {
    touch-action: none !important;
  }

  /* Mobile HUD trigger button (top-left icon button) */
  .mobile-hud-trigger {
    display: flex !important;
    position: absolute;
    top: 12px;
    left: 12px;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: var(--r-control);
    background: var(--bg-surface);
    border: 1px solid var(--line);
    box-shadow: 0 0 0 1px var(--line), var(--shadow-float);
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    cursor: pointer;
    z-index: 25;
    transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  }
  .mobile-hud-trigger:active,
  .mobile-hud-trigger.active {
    background: var(--bg-hover);
    color: var(--text-1);
    border-color: var(--line-strong);
  }

  /* Top HUD on mobile transformed to Bottom Sheet */
  .viewport-hud-top {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto !important;
    width: 100% !important;
    max-height: 48vh !important;
    background: var(--bg-surface);
    border-top: 1px solid var(--line);
    border-left: 0;
    border-right: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(31, 29, 26, 0.12);
    z-index: 60;
    display: flex !important;
    flex-direction: column;
    transform: translateY(105%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px 24px;
    gap: 12px;
  }

  .viewport-hud-top.sheet-open {
    transform: translateY(0);
  }

  .mobile-hud-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 8px;
    border-bottom: 1px solid var(--line);
  }
  .hud-sheet-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-1);
  }
  #btnCloseHudSheet {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .hud-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    border-left: 0 !important;
    padding: 0 !important;
    width: 100%;
    flex-shrink: 0;
  }
  .hud-group > label:not(.checkbox-label) {
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
    padding: 0;
  }
  .hud-group select {
    height: 40px;
    min-height: 40px;
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-control);
    background: var(--bg-panel);
    color: var(--text-1);
    padding: 0 12px;
    font-size: 13px;
    font-weight: 500;
  }
  .hud-group:has(.checkbox-label) {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .checkbox-label {
    height: 40px;
    min-height: 40px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--line);
    border-radius: var(--r-control);
    background: var(--bg-panel);
    justify-content: center;
    white-space: nowrap;
  }
  .checkbox-label input {
    width: 16px;
    height: 16px;
  }

  /* Floating status toast */
  .floating-status {
    bottom: 58px;
    left: 8px;
    right: 8px;
    max-width: calc(100% - 16px);
    z-index: 20;
    font-size: 11px;
    padding: 8px 12px;
    box-sizing: border-box;
    text-align: center;
  }

  /* Appreciation banner */
  .appreciation-banner {
    bottom: 16px;
    left: 12px;
    right: 12px;
    transform: none;
    z-index: 30;
    font-size: 12px;
    padding: 8px 12px;
  }
  #btnExitViewMode {
    min-height: 40px;
    padding: 0 12px;
  }

  /* 3. Mobile Bottom Nav Bar */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 48px;
    background: var(--bg-surface);
    border-top: 1px solid var(--line);
    z-index: 35;
    padding: 4px 12px;
    gap: 8px;
    box-shadow: 0 -2px 12px rgba(31, 29, 26, 0.06);
  }

  .mobile-bottom-nav.nav-hidden {
    display: none !important;
  }

  .mobile-nav-btn {
    flex: 1;
    height: 44px;
    min-height: 40px;
    border: 1px solid var(--line);
    background: var(--bg-panel);
    color: var(--text-2);
    border-radius: var(--r-control);
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  }
  .mobile-nav-btn:active,
  .mobile-nav-btn.active {
    background: var(--bg-hover);
    color: var(--text-1);
    border-color: var(--line-strong);
  }

  /* 4. Sheet handles */
  .sheet-handle-bar {
    display: flex !important;
    justify-content: center;
    align-items: center;
    height: 24px;
    width: 100%;
    cursor: pointer;
    flex-shrink: 0;
    touch-action: none;
    padding-top: 4px;
  }
  .sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--line-strong);
    opacity: 0.8;
  }

  /* 5. Left Panel as Collapsible Bottom Sheet */
  .left-panel {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    max-height: 56vh !important;
    background: var(--bg-surface);
    border-top: 1px solid var(--line);
    border-left: 0;
    border-right: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(31, 29, 26, 0.12);
    z-index: 40;
    display: flex;
    flex-direction: column;
    transform: translateY(105%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .left-panel.sheet-open {
    transform: translateY(0);
  }

  .left-panel .panel-header {
    padding: 0 16px 8px;
    gap: 8px;
  }
  .left-panel .panel-title-row {
    margin-bottom: 2px;
  }
  .left-panel .catalog-sort-select {
    height: 28px;
    font-size: 11px;
  }
  .left-panel .search-box input {
    height: 40px;
    font-size: 13px;
  }

  .left-panel .category-chips {
    padding: 0 12px 8px;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
  }
  .left-panel .category-chips::-webkit-scrollbar {
    display: none;
  }
  .left-panel .cat-chip {
    height: 40px;
    min-height: 40px;
    min-width: 44px;
    padding: 0 12px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
  }

  .left-panel .product-list {
    flex: 1;
    max-height: calc(56vh - 160px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 12px 16px;
    gap: 4px;
  }

  .left-panel .product-card {
    padding: 8px;
  }
  .left-panel .product-card .add-room-btn {
    opacity: 1 !important;
    height: 40px;
    min-height: 40px;
    min-width: 72px;
    padding: 0 12px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-panel);
    border-color: var(--line-strong);
  }
  .left-panel .product-card .add-room-btn:active {
    background: var(--bg-hover);
  }

  .left-panel .left-footer {
    display: none;
  }

  /* 6. Right Panel / Inspector as Bottom Sheet */
  .right-panel {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    max-height: 54vh !important;
    background: var(--bg-surface);
    border-top: 1px solid var(--line);
    border-left: 0;
    border-right: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(31, 29, 26, 0.12);
    z-index: 45;
    display: flex;
    flex-direction: column;
    transform: translateY(105%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 max(20px, env(safe-area-inset-bottom));
  }

  .right-panel.sheet-open {
    transform: translateY(0);
  }

  .right-panel.has-selection {
    transform: translateY(0);
    max-height: 58vh !important;
    z-index: 50;
  }

  .right-panel.room-prods-mode,
  .right-panel:has(#roomProductsInspector:not(.hidden)) {
    transform: translateY(0);
    max-height: 74vh !important;
    z-index: 50;
  }

  .inspector-section {
    padding: 0 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .inspector-header {
    margin-bottom: 2px;
  }

  .icon-close-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Touch controls inside inspector */
  .ctrl-btn {
    min-height: 44px;
    min-width: 44px;
    font-size: 13px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .btn-row {
    gap: 8px;
  }

  .slider-row {
    height: 40px;
    align-items: center;
  }
  .slider-row input[type='range'] {
    height: 28px;
  }

  .swatch-list {
    gap: 8px;
    padding: 4px 0;
  }
  .swatch-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 8px;
  }

  .buy-link-btn {
    min-height: 44px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Room Inspector inside sheet */
  .full-select {
    height: 40px;
    font-size: 13px;
  }

  .dim-inputs-grid input {
    height: 40px;
    font-size: 13px;
  }

  .apply-room-btn {
    height: 40px;
    font-size: 13px;
  }

  .text-btn {
    min-height: 40px;
    min-width: 48px;
    padding: 0 12px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #wallColorPicker {
    min-height: 40px;
    min-width: 40px;
    height: 40px;
    width: 40px;
  }

}

/* ───────── Floor Plan Tracer Studio (T-0015) ───────── */
.tracer-studio {
  width: min(1280px, 98vw);
  height: min(900px, 94vh);
  background: var(--bg-panel);
  border-radius: var(--r-panel);
  box-shadow: 0 0 0 1px var(--line), 0 20px 50px rgba(31, 29, 26, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-in var(--t-enter) var(--ease);
}

.tracer-header {
  padding: 16px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.tracer-header-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tracer-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tracer-title-row h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0;
}

.tracer-badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid var(--line);
}

.tracer-badge.uncalibrated {
  background: rgba(217, 119, 6, 0.1);
  color: var(--warn);
  border-color: rgba(217, 119, 6, 0.25);
}

.tracer-badge.calibrated {
  background: rgba(22, 101, 52, 0.1);
  color: var(--ok);
  border-color: rgba(22, 101, 52, 0.25);
}

.tracer-header-info p {
  font-size: 12px;
  color: var(--text-2);
  margin: 0;
}

.tracer-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tracer-toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--line);
  margin: 0 2px;
}

.tracer-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.tracer-slider-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
}

.tracer-slider-group input[type="range"] {
  width: 80px;
  height: 4px;
  accent-color: var(--accent);
  cursor: pointer;
}

.btn-subtle {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.btn-subtle:hover {
  background: var(--bg-hover);
  border-color: var(--text-3);
}

.btn-subtle.danger:hover {
  background: rgba(185, 28, 28, 0.08);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-primary {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--n-0);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary-sm {
  height: 28px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--n-0);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  cursor: pointer;
}

.btn-subtle-sm {
  height: 28px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-1);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

.btn-subtle-sm:hover {
  background: var(--bg-hover);
}

.tracer-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--n-25);
}

#tracerCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* ───────── Edge Popover ───────── */
.tracer-edge-popover {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 270px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(31, 29, 26, 0.12);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
  animation: modal-in 0.18s var(--ease);
}

.popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.popover-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}

.popover-length {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.popover-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popover-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
}

.popover-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.popover-input-row input {
  flex: 1;
  height: 28px;
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-surface);
  color: var(--text-1);
}

.popover-input-row .unit-text {
  font-size: 11px;
  color: var(--text-3);
}

.popover-buttons-row {
  display: flex;
  gap: 8px;
}

.popover-buttons-row button {
  flex: 1;
}

.popover-openings-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 140px;
  overflow-y: auto;
}

.popover-op-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
}

.popover-op-info {
  display: flex;
  align-items: center;
  gap: 4px;
}

.popover-op-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 4px;
}

.popover-op-badge.window {
  background: rgba(2, 132, 199, 0.12);
  color: var(--text-2);
}

.popover-op-badge.door {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warn);
}

/* ───────── Tracer Bottom Bar ───────── */
.tracer-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 16px;
  background: var(--bg-panel);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-2);
  flex-wrap: wrap;
  pointer-events: none;
}

.bar-sep {
  color: var(--line);
}

/* ───────── Toast Notification (T-0024) ───────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--n-900);
  color: var(--n-25);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  padding: 8px 16px;
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-float);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  pointer-events: auto;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ───────── Template Rooms Modal (T-0024) ───────── */
.template-studio {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  width: 960px;
  max-width: 94vw;
  max-height: 90vh;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 20px 40px rgba(31, 29, 26, 0.12), 0 2px 8px rgba(31, 29, 26, 0.06);
  overflow-y: auto;
}

.template-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.template-card {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.template-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-float);
}

.template-thumb-wrap {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--n-50);
  overflow: hidden;
  position: relative;
  border-bottom: 1px solid var(--line);
}

.template-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.template-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.template-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0;
  line-height: 1.3;
}

.template-card-tagline {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-card-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.template-item-badge {
  font-size: 11px;
  color: var(--text-2);
  background: var(--n-50);
  padding: 2px 8px;
  border-radius: 4px;
}

.template-total-price {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

.template-card-btn {
  width: 100%;
  height: 36px;
  margin-top: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.template-card:hover .template-card-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--n-0);
}

.template-modal-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 4px;
}

.btn-start-empty {
  background: transparent;
  border: 0;
  color: var(--text-3);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 8px 12px;
  transition: color var(--t-fast) var(--ease);
}

.btn-start-empty:hover {
  color: var(--text-1);
}

@media (max-width: 768px) {
  .template-studio {
    padding: 16px;
    gap: 16px;
    max-height: 85vh;
  }
  .template-cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* ───────── Room Products Panel & Status Handling (T-0025) ───────── */
.cart-pill.clickable {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-control);
  transition: background-color var(--t-fast) var(--ease);
}
.cart-pill.clickable:hover {
  background: var(--bg-hover);
}
.cart-pill.clickable:active {
  background: var(--bg-subtle);
}

.price-val-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stock-status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-3);
  border: 1px solid var(--line);
}

.buy-link-btn.disabled,
.buy-link-btn:disabled {
  background: var(--bg-subtle) !important;
  color: var(--text-3) !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
  border: 1px solid var(--line);
  box-shadow: none !important;
}

.room-prods-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-products-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1;
}

.room-prod-row {
  display: flex;
  flex-direction: column;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}

.room-prod-row:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.room-prod-row.is-active-item {
  border-color: var(--accent);
  background: var(--bg-subtle);
  box-shadow: 0 0 0 1px var(--accent);
}

.room-prod-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.room-prod-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.room-prod-cat {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  line-height: 1.2;
  margin-bottom: 2px;
}

.room-prod-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.35;
  height: calc(1.35em * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: keep-all;
}

.room-prod-sub-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
}

.room-prod-brand {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-prod-qty {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-2);
}

.status-badge-stock {
  font-size: 11px;
  font-weight: 500;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-3);
  border: 1px solid var(--line);
}

.room-prod-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.room-prod-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

.room-prod-buy-btn {
  height: 28px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-1);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  white-space: nowrap;
}

.room-prod-buy-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--n-0);
}

.room-prod-buy-btn.disabled,
.room-prod-buy-btn:disabled {
  opacity: 0.45;
  background: var(--bg-subtle);
  color: var(--text-3);
  border-color: var(--line);
  cursor: not-allowed;
  pointer-events: none;
}

.room-products-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-surface);
  margin-top: auto;
}

.room-products-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.room-products-total-row .total-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.room-products-total-row .total-price {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ==================== T-0027: "이 공간 그대로 구매하기" & 추천 & 예산 UI ==================== */

/* 상단 전체 구매 & 안내 */
.room-prods-action-box {
  padding: 12px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.room-prods-grand-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.room-prods-grand-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.room-prods-grand-val {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

.room-prods-stores-notice {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.4;
}

.room-prods-unavail-notice {
  font-size: 11px;
  color: var(--accent);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: var(--r-control);
}

.buy-all-btn {
  height: 40px;
  width: 100%;
  margin-top: 4px;
  background: var(--accent);
  color: var(--n-0);
  border: none;
  border-radius: var(--r-control);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--t-fast) var(--ease);
}

.buy-all-btn:hover {
  opacity: 0.92;
}

/* 예산 맞추기 섹션 */
.budget-section {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-surface);
}

.budget-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.budget-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
}

.budget-subtitle {
  font-size: 11px;
  color: var(--text-3);
}

.budget-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.budget-input {
  flex: 1;
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  font-size: 12px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  background: var(--bg-surface);
  color: var(--text-1);
  box-sizing: border-box;
}

.budget-input:focus {
  outline: none;
  border-color: var(--accent);
}

.budget-calc-btn {
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-subtle);
  color: var(--text-1);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.budget-calc-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.budget-preview-box {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.budget-preview-summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
}

.budget-preview-saving {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

.budget-swaps-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 4px 0;
}

.budget-swap-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-2);
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}

.budget-swap-item:last-child {
  border-bottom: none;
}

.budget-apply-btn {
  height: 32px;
  width: 100%;
  margin-top: 4px;
  background: var(--accent);
  color: var(--n-0);
  border: none;
  border-radius: var(--r-control);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.budget-apply-btn:hover {
  opacity: 0.92;
}

/* 판매처별 그룹 카드 */
.seller-group-card {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--bg-surface);
}

.seller-group-header {
  padding: 12px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.seller-group-title-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.seller-group-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}

.seller-group-note {
  font-size: 11px;
  color: var(--text-3);
}

.seller-group-right-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.seller-group-meta {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 11px;
  color: var(--text-3);
}

.seller-group-subtotal {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

.seller-group-open-btn {
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  border-radius: var(--r-control);
  cursor: pointer;
  white-space: nowrap;
}

.seller-group-open-btn:hover {
  background: var(--accent);
  color: var(--n-0);
}

.seller-group-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
}

.seller-store-links-tray {
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}

.seller-link-anchor {
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seller-link-anchor:hover {
  text-decoration: underline;
}

/* 상품 행 내부 액션 (잠금 버튼, 대신 이것 버튼) */
.room-prod-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-lock-toggle {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.btn-lock-toggle .icon {
  width: 14px;
  height: 14px;
}

.btn-lock-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-lock-toggle.is-locked {
  background: var(--bg-subtle);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-alt-replace-pill {
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--n-0);
  background: var(--accent);
  border: none;
  border-radius: var(--r-control);
  cursor: pointer;
  white-space: nowrap;
}

.btn-alt-replace-pill:hover {
  opacity: 0.9;
}

/* 상세 패널 추천 블록 */
.sel-alt-replace-wrap {
  margin: 8px 0;
  padding: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.alt-replace-btn {
  width: 100%;
  height: 36px;
  font-size: 12px;
  font-weight: 600;
  color: var(--n-0);
  background: var(--accent);
  border: none;
  border-radius: var(--r-control);
  cursor: pointer;
}

.rec-block {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.rec-block-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.rec-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
}

.rec-hint {
  font-size: 11px;
  color: var(--text-3);
}

.rec-cards-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rec-card {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--bg-surface);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.rec-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.rec-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.rec-card-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-card-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.rec-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.rec-card-price {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

.saving-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--bg-subtle);
  padding: 0 4px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.rec-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.match-card {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--bg-surface);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.match-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.match-card-cat {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
}

.match-card-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.3;
  height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}

.match-card-price {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

.match-card-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--line);
}

#selDimensions {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
  .room-prod-buy-btn,
  .seller-group-open-btn,
  .btn-alt-replace-pill {
    height: 36px;
    padding: 0 12px;
  }
  .buy-all-btn {
    min-height: 44px;
    font-size: 14px;
  }
  .budget-calc-btn {
    height: 36px;
    min-width: 60px;
    padding: 0 12px;
  }
  .budget-apply-btn {
    min-height: 40px;
    font-size: 13px;
  }
  .rec-card {
    min-height: 44px;
  }
}

/* Claude T-0029 검증: 좁은 화면에서 편집/감상 글자가 세로로 깨지지 않게 */
.mode-btn { white-space: nowrap; }
@media (max-width: 480px) {
  .mode-btn .icon { display: none; }
}

/* ───────── T-0031: 공정위 제휴 고지 및 하단 정보 영역 ───────── */
.affiliate-notice {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-3);
  word-break: keep-all;
}

#selAffiliateNotice {
  margin-top: 8px;
  padding: 0 2px;
}

.room-prods-affiliate-notice {
  margin-top: 8px;
  margin-bottom: 2px;
  padding: 8px 12px;
  background: var(--bg-hover);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}

.app-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.footer-affiliate-notice {
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 2px;
}

.footer-primary-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-brand {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.footer-disclaimer {
  font-size: 12px;
  color: var(--text-3);
}

.footer-secondary-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-3);
}

.footer-contact {
  font-family: var(--font-mono);
  font-size: 11px;
}

.footer-sep {
  color: var(--text-3);
  opacity: 0.5;
}

.footer-link {
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}

.footer-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* 구매 링크 a 태그 호환성 스타일 보장 */
a.room-prod-buy-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

@media (max-width: 768px) {
  .left-panel .app-footer {
    padding: 8px 12px;
    gap: 4px;
  }
}

/* ───────── T-0032: 접근성(A11y), 빈 방 첫 안내, 키보드 조작 안내 ───────── */
.empty-room-guide {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 104px;
  width: max-content;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 32px);
  padding: 8px 8px 8px 16px;
  background: var(--bg-surface);
  border-radius: var(--r-card);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-float);
  z-index: 15;
  pointer-events: none;
}

.empty-room-text {
  font-size: 13px;
  color: var(--text-2);
  margin: 0;
  user-select: none;
}

.empty-room-btn {
  pointer-events: auto;
  flex: none;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  border: 1px solid var(--line-strong);
  color: var(--text-1);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.empty-room-btn:hover { background: var(--bg-hover); border-color: var(--text-3); }

.keyboard-shortcuts-bar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong);
  border-radius: 9999px;
  box-shadow: 0 1px 3px rgba(31, 29, 26, 0.06);
  font-size: 11px;
  color: var(--text-2);
  z-index: 10;
  pointer-events: none;
  white-space: nowrap;
}

.shortcut-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.keyboard-shortcuts-bar kbd {
  display: inline-block;
  padding: 0 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-1);
  background: var(--n-50);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(31, 29, 26, 0.08);
}

.keyboard-shortcuts-bar .bar-sep {
  color: var(--text-3);
  font-size: 11px;
}

.placed-row {
  outline: none;
  cursor: pointer;
}

.placed-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-radius: var(--r-control);
}

.template-card {
  outline: none;
  cursor: pointer;
}

.template-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cart-pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .keyboard-shortcuts-bar {
    display: none !important;
  }
}

/* Claude T-0032 검증: 단축키 바는 선택 시에만, 상태 표시줄 위로. 유리 블러 대신 단색 */
.keyboard-shortcuts-bar { display: none; bottom: 56px; background: var(--bg-panel); backdrop-filter: none; -webkit-backdrop-filter: none; border-radius: var(--r-control); }
.keyboard-shortcuts-bar.is-visible { display: flex; }
@media (max-width: 768px) { .keyboard-shortcuts-bar.is-visible { display: none; } }

/* ───────── 이 방의 상품: 좁은 패널(≈290px)에서 행 재배치 ─────────
   썸네일 | 정보 (2줄 상품명)  /  가격 ······ 잠금·판매처  */
.room-prod-main {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-areas: "thumb info" "right right";
  column-gap: 10px;
  row-gap: 8px;
  align-items: start;
}
.room-prod-main > .card-thumb { grid-area: thumb; }
.room-prod-info { grid-area: info; }
.room-prod-right {
  grid-area: right;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding-left: 48px;
}
.room-prod-name { height: auto; }
.room-prod-sub-line { white-space: nowrap; }
.seller-group-items { padding: 8px; }
.room-prod-row { padding: 12px; }

/* T-0035: 헤더 개수 옆 품절 표기, 마우스로 연 패널의 컨테이너 포커스 */
.placed-unavail-badge { font-size: 11px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
#roomProductsInspector:focus { outline: none; }

button.footer-link { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ───────── 로그인 · 내 방 (T-0036, 백엔드 설정 시에만 노출) ───────── */
.account-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  height: fit-content;
  width: min(400px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--bg-surface);
  color: var(--text-1);
}
.account-dialog::backdrop { background: rgba(31, 29, 26, 0.32); }
.account-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px 20px; }
.account-head h2 { font-size: 16px; font-weight: 600; margin: 0; }
.account-close { width: 32px; height: 32px; border: 0; background: transparent; border-radius: var(--r-control); display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.account-close:hover { background: var(--bg-hover); }
.account-body { padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.account-lead { font-size: 13px; color: var(--text-2); line-height: 1.5; margin: 0; }
.account-providers { display: flex; flex-direction: column; gap: 8px; }
.account-provider-btn {
  height: 44px; border-radius: var(--r-control); font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--bg-surface); color: var(--text-1);
}
.account-provider-btn.is-kakao { background: #FEE500; border-color: #FEE500; color: rgba(0, 0, 0, 0.85); }
.account-provider-btn:hover { filter: brightness(0.97); }
.account-row { display: flex; gap: 8px; }
.account-title-input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-control); font: inherit; font-size: 13px; }
.account-save-btn { height: 36px; padding: 0 12px; border: 0; border-radius: var(--r-control); background: var(--accent); color: var(--n-0); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.account-room-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: 320px; overflow: auto; }
.account-room { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "title load del" "date load del"; column-gap: 6px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.account-room-title { grid-area: title; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-room-date { grid-area: date; font-size: 11px; color: var(--text-3); }
.account-room-load, .account-room-del { height: 28px; padding: 0 12px; font-size: 12px; border-radius: var(--r-control); border: 1px solid var(--line); background: var(--bg-surface); cursor: pointer; }
.account-room-load { grid-area: load; }
.account-room-del { grid-area: del; color: var(--text-3); }
.account-empty { font-size: 13px; color: var(--text-3); padding: 12px 0; border-top: 1px solid var(--line); }
.account-signout-btn { align-self: flex-start; border: 0; background: none; padding: 0; font-size: 12px; color: var(--text-3); cursor: pointer; text-decoration: underline; }

/* ───────── unslop 패스 (2026-11-11): 헤더 넘침, hidden 속성, 사진 방 모달 ───────── */
/* display 를 지정한 컴포넌트(.tool-btn 등)도 hidden 속성이면 숨김 — 미설정 로그인 버튼이 보이던 문제 */
[hidden] { display: none !important; }
/* 헤더 라벨·합계는 줄바꿈 금지 (좁아지면 라벨을 숨기고 아이콘만) */
.tool-btn span, .cart-pill .cart-count, .cart-pill .cart-total { white-space: nowrap; }
@media (max-width: 1560px) {
  #btnOpenConverter span, #btnOpenTemplates span { display: none; }
  #btnOpenConverter, #btnOpenTemplates { padding: 0 8px; }
}
@media (max-width: 768px) {
  #btnOpenRoomVision span { display: none; }
  #btnOpenRoomVision { padding: 0 8px; }
}
/* 사진으로 방 만들기 대화상자 — 인라인 스타일을 클래스로 옮김 (roomVisionUI.js) */
.room-vision-dialog {
  width: min(680px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-panel);
  border: 0;
  border-radius: var(--r-panel);
  box-shadow: 0 0 0 1px var(--line), 0 20px 50px rgba(31, 29, 26, 0.18);
  color: var(--text-1);
}
.rv-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.rv-title { margin: 0; font-size: 16px; font-weight: 600; }
.rv-stepper { display: flex; border-bottom: 1px solid var(--line); background: var(--bg-hover); font-size: 12px; }
.rv-step {
  flex: 1;
  padding: 12px 4px;
  text-align: center;
  white-space: nowrap;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  font-variant-numeric: tabular-nums;
}
.rv-step.active { font-weight: 600; color: var(--accent); border-bottom-color: var(--accent); }
.rv-body { flex: 1; padding: 20px; overflow-y: auto; font-size: 13px; line-height: 1.5; }
.rv-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--line); }
.rv-footer-actions { margin-left: auto; display: flex; gap: 8px; }

.rv-row { display: flex; align-items: center; gap: 8px; }
.rv-row-tight { display: flex; align-items: center; gap: 4px; }
.rv-list { display: flex; flex-direction: column; gap: 8px; }
.rv-list-gap { margin-bottom: 12px; }
.rv-label { font-size: 12px; font-weight: 500; }
.rv-field-label { display: block; margin-bottom: 4px; font-size: 11px; color: var(--text-3); }
.rv-meta { font-size: 11px; color: var(--text-3); }
.rv-note { font-size: 12px; color: var(--text-3); }
.rv-note-gap { margin-top: 12px; }

.rv-tip { margin-bottom: 16px; padding: 12px 16px; background: var(--bg-active); border-radius: var(--r-control); }
.rv-tip-title { margin-bottom: 4px; font-weight: 600; }
.rv-tip-text { margin: 0; font-size: 12px; color: var(--text-2); }
.rv-tip-list { padding-left: 16px; }

.rv-notice { margin-bottom: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--bg-surface); font-size: 12px; line-height: 1.4; color: var(--text-2); }
.rv-notice.is-warn { color: var(--warn); border-color: var(--line-strong); }

.rv-dropzone {
  padding: 24px 16px;
  text-align: center;
  background: var(--bg-surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-control);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.rv-dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.rv-drop-title { margin-bottom: 4px; font-weight: 500; }
.rv-drop-sub { margin-bottom: 12px; font-size: 12px; color: var(--text-3); }
.rv-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.rv-thumb { position: relative; width: 88px; height: 68px; overflow: hidden; border-radius: var(--r-control); box-shadow: 0 0 0 1px var(--line-strong); background: var(--bg-hover); }
.rv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rv-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: var(--n-900);
  color: var(--n-0);
  opacity: 0.8;
}
.rv-thumb-remove .icon { width: 12px; height: 12px; }
.rv-mode-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }

.rv-card { margin-bottom: 12px; padding: 12px 16px; background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--r-control); }
.rv-card:last-child { margin-bottom: 0; }
.rv-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.rv-card-title { font-size: 13px; font-weight: 600; }
.rv-item-title { font-size: 13px; font-weight: 500; }
.rv-ref-grid { display: grid; grid-template-columns: 140px 1fr; gap: 12px 16px; align-items: center; padding: 16px; }
.rv-dims-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rv-furniture-row, .rv-opening-row { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 12px; }
.rv-furniture-row { justify-content: space-between; }

.rv-tag { margin-left: 4px; padding: 0 4px; border-radius: 4px; background: var(--bg-hover); font-size: 11px; line-height: 16px; color: var(--text-2); }
.rv-tag.is-ok { color: var(--ok); }

.rv-select, .rv-input {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--bg-surface);
  font-size: 13px;
  color: var(--text-1);
}
.rv-input { width: 100%; font-variant-numeric: tabular-nums; }
.rv-input-ref { width: 120px; }
.rv-input-num { width: 56px; }
.rv-opening-row .rv-select, .rv-opening-row .rv-input { height: 28px; font-size: 12px; }
.rv-select:focus, .rv-input:focus { outline: none; border-color: var(--accent); }

.rv-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--bg-surface);
  font-size: 13px;
  color: var(--text-1);
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.rv-btn:hover { background: var(--bg-hover); }
.rv-btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.rv-btn-dashed { border-style: dashed; color: var(--text-2); }
.rv-btn-primary { border-color: var(--accent); background: var(--accent); color: var(--n-0); font-weight: 500; }
.rv-btn-primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.rv-icon-btn { margin-left: auto; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-3); }
.rv-icon-btn:hover { background: var(--bg-hover); color: var(--danger); }

@media (max-width: 480px) {
  .rv-header, .rv-footer { padding: 12px 16px; }
  .rv-body { padding: 16px; }
  .rv-ref-grid { grid-template-columns: 1fr; gap: 8px; }
}

/* ── 코드에 박혀 있던 고정 스타일 (T-0052). 값은 옮기기 전과 같다 ── */
.copy-source { position: fixed; opacity: 0; }

.context-notice {
  position: absolute; top: 24px; left: 50%; transform: translateX(-50%); z-index: 900;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px; border-radius: 8px;
  background-color: #2c2a29; color: #f5f2eb;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px; line-height: 1.4;
}
.context-notice-btn {
  background: #7a4a26; color: #ffffff; border: none; border-radius: 4px;
  padding: 5px 12px; font-size: 12px; font-weight: 500; cursor: pointer;
}

.rec-note { font-size: 11px; color: var(--text-3); margin-bottom: 6px; }
.rec-empty { font-size: 11px; color: var(--text-3); padding: 4px 0; }
.rec-empty-wide { grid-column: 1 / -1; }
.rec-diff { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.placed-empty { padding: 24px 16px; text-align: center; color: var(--text-3); font-size: 13px; }
.placed-quick-label { font-weight: 600; color: var(--text-2); margin-bottom: 2px; }
.card-thumb.placed-thumb { width: 40px; height: 40px; flex: none; border-radius: 6px; object-fit: contain; background: var(--n-100); }

.budget-ok { color: var(--text-2); font-weight: 500; }
.budget-none { color: var(--accent); }
.budget-swaps { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.budget-swap-names { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.budget-swap-saving { font-weight: 600; color: var(--accent); white-space: nowrap; }

.conv-export-candidate { margin-left: 4px; }

.product-card .stock-status-badge.stock-badge-fixed { flex-shrink: 0; }
.product-card .card-top.card-top-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; overflow: hidden; min-height: 16px; }
.product-card .card-price.card-price-fixed { white-space: nowrap; flex-shrink: 0; }

.tracer-ops-empty { font-size: 11px; color: var(--text-3); }
.text-btn.danger.tracer-op-delete { padding: 0; min-height: 20px; font-size: 11px; }
