.wb-grid {
  display: grid;
  grid-template-columns: 410px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  width: 100%;
}

.wb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 32px);
  min-height: 640px;
  overflow: hidden;
  position: relative;
}

.wb-left-top {
  flex-shrink: 0;
  padding: 18px 18px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wb-switcher {
  width: 100%;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.wb-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  border-radius: 10px;
  background: #F5F5F5;
  border: 0;
}
.wb-tab {
  min-height: 36px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.wb-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.wb-left-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.wb-stack { display: flex; flex-direction: column; gap: 16px; }
.wb-stack[hidden] { display: none; }
.wb-swatch { display: block; width: 100%; height: 100%; }

.wb-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

/* Upload well matching h-64 + View Case Demo */
.wb-drop {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 248px;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}
.wb-drop:hover, .wb-drop.is-drag {
  border-color: var(--primary);
  background: var(--bg);
}
.wb-drop-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 8px;
}
.wb-drop-icon { color: var(--muted); }
.wb-drop-title { font-size: 14px; color: var(--muted); line-height: 1.4; }
.wb-drop-sub { font-size: 13px; color: var(--muted); }
.wb-drop-preview-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  height: 248px;
  background: var(--bg);
}
.wb-drop-preview-wrap img { width: 100%; height: 100%; object-fit: cover; }
.wb-clear-x {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: var(--ink); color: var(--surface); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}

.wb-demo-divider {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 8px;
  font-size: 13px; font-weight: 500; color: var(--muted);
}
.wb-demo-divider::before, .wb-demo-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.wb-demo-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; position: relative; z-index: 2;
}
.wb-demo-btn {
  padding: 0; border: 2px solid var(--border); border-radius: 8px; overflow: hidden;
  aspect-ratio: 1 / 1; cursor: pointer; background: var(--surface-alt);
}
.wb-demo-btn:hover { border-color: var(--primary); }
.wb-demo-btn img { width: 100%; height: 100%; object-fit: cover; }

/* Template / Custom segmented bar */
.wb-seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px;
  border-radius: 8px; background: #F5F5F5; border: 0;
}
.wb-seg--proj {
  gap: 8px; padding: 4px; background: #F9FAFB;
}
.wb-seg-btn {
  min-height: 40px; border: 0; border-radius: 6px; background: transparent;
  color: #6B7280; font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.wb-seg-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.7); }
.wb-seg-btn.is-active {
  background: var(--surface); color: var(--primary); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* ChooseRow cards */
.wb-choose-btn {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 8px; border-radius: 8px; border: 0;
  background: #F9FAFB; text-align: left; cursor: pointer;
  transition: background-color 0.15s ease;
}
.wb-choose-btn:hover { background: #F3F4F6; }
.wb-choose-thumb {
  width: 48px; height: 48px; border-radius: 8px; overflow: hidden; flex-shrink: 0;
  background: #E5E7EB; display: flex; align-items: center; justify-content: center; color: var(--muted);
}
.wb-choose-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wb-choose-thumb img[hidden] { display: none; }
.wb-choose-fallback { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.wb-choose-fallback[hidden] { display: none; }
.wb-choose-meta { flex: 1; min-width: 0; }
.wb-choose-val { display: block; font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-choose-hint { display: block; font-size: 12px; color: #9CA3AF; margin-top: 2px; }
.wb-choose-pill {
  flex-shrink: 0; padding: 7px 16px; border-radius: 999px;
  border: 1px solid var(--primary); background: var(--surface);
  color: var(--primary); font-size: 13px; font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.wb-choose-btn:hover .wb-choose-pill { background: var(--primary); color: var(--surface); }

/* Exteriors 2x2 selects + checkboxes */
.wb-ext-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wb-ext-select {
  width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: #F9FAFB; color: var(--ink);
  font-family: var(--font-sans); font-size: 13px; font-weight: 500; cursor: pointer;
}
.wb-ext-el-box { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wb-ext-chk {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 8px; border: 1px solid var(--border); background: #F9FAFB;
  font-size: 13px; color: var(--ink); cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}
.wb-ext-chk input { accent-color: var(--primary); margin: 0; }
.wb-ext-chk.is-checked {
  border-color: var(--primary); background: rgba(38, 61, 50, 0.06);
  font-weight: 600; color: var(--primary);
}
.wb-ext-toggle {
  margin-top: 8px; padding: 0; border: 0; background: transparent;
  color: var(--primary); font-size: 13px; font-weight: 600; cursor: pointer;
}
.wb-ext-toggle:hover { text-decoration: underline; }

/* Keep furniture switch card */
.wb-toggle-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px; border-radius: 8px; background: #F9FAFB; border: 0; cursor: pointer;
}
.wb-toggle-title { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0; }
.wb-toggle-sub { font-size: 12px; color: var(--muted); margin: 2px 0 0; line-height: 1.35; }
.wb-pill-switch {
  position: relative; width: 44px; height: 24px; flex-shrink: 0;
}
.wb-pill-switch input { opacity: 0; width: 0; height: 0; }
.wb-pill-track {
  position: absolute; inset: 0; border-radius: 999px; background: var(--surface-alt);
  border: 1px solid var(--border); transition: background-color 0.18s ease;
}
.wb-pill-track::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease;
}
.wb-pill-switch input:checked + .wb-pill-track { background: var(--primary); border-color: var(--primary); }
.wb-pill-switch input:checked + .wb-pill-track::after { transform: translateX(20px); }

.wb-textarea {
  width: 100%; min-height: 76px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: #F9FAFB; color: var(--ink);
  font-family: var(--font-sans); font-size: 14px; resize: none;
}

/* Sticky Bottom Model + Gear + Generate Bar */
.wb-left-foot {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 16px 18px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.wb-model-trigger {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  border: 0; background: rgba(38, 61, 50, 0.06);
  text-align: left; cursor: pointer;
  transition: background-color 0.15s ease;
}
.wb-model-trigger:hover { background: rgba(38, 61, 50, 0.10); }
.wb-model-badge {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
}
.wb-model-badge--muted { background: #F4F4F5; color: #52525B; }
.wb-model-info { flex: 1; min-width: 0; }
.wb-model-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.wb-model-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.wb-model-rec {
  padding: 2px 7px; border-radius: 999px;
  background: rgba(38, 61, 50, 0.10); color: var(--primary);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
}
.wb-model-rec[hidden] { display: none; }
.wb-model-hint { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-model-chev { color: var(--muted); flex-shrink: 0; transition: transform 0.16s ease; }
.wb-model-trigger[aria-expanded="true"] .wb-model-chev { transform: rotate(180deg); }

.wb-model-pop {
  position: absolute; bottom: calc(100% + 6px); left: 18px; right: 18px; z-index: 40;
  background: var(--surface); border: 1px solid #E4E4E7; border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12); overflow: hidden;
}
.wb-model-pop[hidden] { display: none; }
.wb-model-opt {
  width: 100%; padding: 11px 12px; border: 0; border-top: 1px solid #F4F4F5;
  background: var(--surface); text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  transition: background-color 0.12s ease;
}
.wb-model-opt:first-child { border-top: 0; }
.wb-model-opt:hover { background: rgba(38, 61, 50, 0.05); }
.wb-radio {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid #D4D4D8; display: inline-flex; align-items: center; justify-content: center;
}
.wb-model-opt.is-active .wb-radio { border-color: var(--primary); }
.wb-radio-dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.wb-model-opt.is-active .wb-radio-dot { background: var(--primary); }

.wb-popover {
  position: absolute; bottom: calc(100% + 6px); left: 18px; right: 18px; z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; box-shadow: var(--shadow-md); display: flex; flex-direction: column; gap: 12px;
}
.wb-popover[hidden] { display: none; }

.wb-gen-row { display: flex; align-items: stretch; gap: 8px; }
.wb-gear-btn {
  width: 48px; flex-shrink: 0; border-radius: 8px; border: 0;
  background: var(--surface-alt); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.wb-gear-btn:hover { background: var(--border); }

.wb-chip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.wb-chip-grid--4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.wb-chip {
  min-height: 36px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
.wb-chip.is-active { background: var(--primary); color: var(--surface); border-color: var(--primary); }

.wb-res-strip { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; }
.wb-res-strip[hidden] { display: none; }
.wb-res-thumb {
  width: 58px; height: 44px; padding: 0; border-radius: 8px;
  border: 2px solid var(--border); overflow: hidden; cursor: pointer; background: var(--bg);
}
.wb-res-thumb.is-active, .wb-res-thumb:hover { border-color: var(--primary); }
.wb-res-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.wb-gen-btn {
  flex: 1; min-height: 46px; border-radius: 10px; border: 0;
  background: var(--surface-alt); color: var(--muted); font-family: var(--font-sans);
  font-size: 14px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color 0.16s ease, color 0.16s ease;
}
.wb-gen-btn.is-ready { background: var(--primary); color: var(--surface); }
.wb-gen-btn.is-ready:hover { background: var(--primary-hover); }
.wb-gen-btn:disabled { opacity: 0.65; cursor: not-allowed; }
.wb-foot-hint { font-size: 12px; color: var(--muted); text-align: center; margin: 0; }

.wb-status {
  padding: 10px 12px; border-radius: 10px; font-size: 13px;
  background: var(--bg); border: 1px solid var(--border); color: var(--ink);
}
.wb-status--err { border-color: var(--accent); background: var(--surface-alt); }
.wb-status--ok { border-color: var(--primary); background: var(--surface-alt); color: var(--primary); }

/* Visual Option Picker Modal + 11-Tab Elements Header */
.wb-modal-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.wb-modal-backdrop[hidden] { display: none; }
.wb-modal {
  width: 100%; max-width: 896px; max-height: 84vh; background: var(--surface);
  border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; overflow: hidden;
}
.wb-modal-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.wb-modal-head strong { font-size: 16px; font-weight: 600; color: var(--ink); }
.wb-modal-x {
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.wb-modal-x:hover { background: var(--bg); color: var(--ink); }
.wb-modal-tabs {
  display: flex; gap: 4px; padding: 6px 14px 0; border-bottom: 1px solid var(--border);
  overflow-x: auto; flex-shrink: 0;
}
.wb-modal-tabs[hidden] { display: none; }
.wb-modal-tab {
  border: 0; border-bottom: 2px solid transparent; background: transparent;
  padding: 10px 14px; font-size: 14px; font-weight: 500; color: var(--muted);
  cursor: pointer; white-space: nowrap;
}
.wb-modal-tab.is-active {
  color: var(--primary); border-bottom-color: var(--primary); font-weight: 600;
}
.wb-modal-scroll { padding: 16px; overflow-y: auto; flex: 1; min-height: 0; }
.wb-modal-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
}
.wb-opt-card {
  display: block; width: 100%; padding: 0; border: 2px solid var(--border);
  border-radius: 12px; overflow: hidden; background: var(--surface);
  cursor: pointer; text-align: left; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.wb-opt-card:hover { border-color: var(--primary); }
.wb-opt-card.is-selected {
  border-color: var(--primary); box-shadow: 0 0 0 2px rgba(38, 61, 50, 0.14);
}
.wb-opt-imgwrap {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 3;
  overflow: hidden; background: #F1F5F9;
}
.wb-opt-imgwrap img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.25s ease;
}
.wb-opt-card:hover .wb-opt-imgwrap img { transform: scale(1.04); }
.wb-opt-fallback {
  display: flex; width: 100%; height: 100%; align-items: center; justify-content: center;
  color: var(--muted);
}
.wb-opt-check {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary); color: var(--surface);
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm);
}
.wb-opt-body { display: block; padding: 8px 8px 10px; text-align: center; }
.wb-opt-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.wb-opt-desc { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.3; }
.wb-modal-foot {
  display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0;
}
.wb-modal-foot-btn {
  flex: 1; min-height: 40px; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--ink);
}
.wb-modal-foot-btn:hover { background: var(--bg); }
.wb-modal-foot-btn--ok {
  border-color: var(--primary); background: var(--primary); color: var(--surface);
}
.wb-modal-foot-btn--ok:hover { background: var(--primary-hover); }

/* Right Preview / History Panel */
.wb-right { padding: 20px 24px; }
.wb-preview-tabs {
  margin: 0 auto 16px; width: 260px; display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px; padding: 5px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border);
  flex-shrink: 0;
}
.wb-preview-tab {
  min-height: 36px; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 700; cursor: pointer;
}
.wb-preview-tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.wb-preview-well {
  flex: 1; min-height: 0; border: 1.5px dashed var(--border); border-radius: 14px;
  padding: 20px; display: flex; flex-direction: column; align-items: center; text-align: center;
  overflow: hidden; position: relative;
}
.wb-ai-badge-row {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 14px;
}
.wb-ai-spark { color: #FABF24; flex-shrink: 0; }
.wb-ai-badge {
  display: inline-block; padding: 6px 16px; border-radius: 999px;
  background: linear-gradient(to right, #FEF3C7, #FABF24); color: #91400F;
  font-size: 12px; font-weight: 600; line-height: 1.2;
}
.wb-stage-title {
  font-family: var(--font-sans); font-size: 36px; font-weight: 700;
  color: var(--ink); margin: 0 0 8px; line-height: 1.15; letter-spacing: -0.025em;
}
.wb-stage-sub {
  font-size: 15px; color: var(--muted); max-width: 56ch; margin: 0 auto 18px;
}
.wb-compare-box {
  width: 100%; max-width: 720px; flex: 1; min-height: 240px;
  border: 1px solid var(--border); border-radius: 14px; padding: 12px;
  background: var(--bg); display: flex; flex-direction: column; justify-content: center;
}
.wb-compare-inner {
  position: relative; width: 100%; height: 100%; min-height: 220px;
  border-radius: 10px; overflow: hidden; background: var(--ink);
}
.wb-compare-inner .ba-frame { height: 100%; border: 0; border-radius: 10px; }
.wb-compare-inner .ba-frame > img { width: 100%; height: 100%; object-fit: cover; }
.wb-uploaded-stage { width: 100%; height: 100%; max-height: 440px; object-fit: contain; display: block; }
.wb-stage-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; }

.wb-loading {
  position: absolute; inset: 0; background: var(--ink); opacity: 0.9; color: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  z-index: 10; border-radius: 14px; padding: 20px;
}
.wb-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--muted); border-top-color: var(--surface);
  animation: wbSpin 0.8s linear infinite;
}
@keyframes wbSpin { to { transform: rotate(360deg); } }

.wb-history-panel { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 4px; }
.wb-history-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.wb-hist-card {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--surface); cursor: pointer; padding: 0; text-align: left;
}
.wb-hist-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.wb-hist-cap { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--ink); }

@media (max-width: 1120px) {
  .wb-grid { grid-template-columns: 1fr; }
  .wb-card { height: auto; min-height: 0; overflow: visible; }
  .wb-left-scroll { overflow: visible; }
  .wb-compare-inner { aspect-ratio: 16 / 10; }
}
@media (max-width: 640px) {
  .wb-modal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wb-stage-title { font-size: 26px; }
  .wb-history-grid { grid-template-columns: 1fr; }
}