/* ---------- Add Border (bd-*) ---------- */
/* Panggung preview di kiri, inspector di kanan; satu gambar per sesi. */
#bd-app {
  display: block;
}

/* Tooltip badge di header tool: anchor kanan agar tidak menambah lebar halaman. */
.tool-layout:has(#bd-app) .proc-tip-bubble {
  left: auto;
  right: -9px;
}
.tool-layout:has(#bd-app) .proc-tip-bubble::after {
  left: auto;
  right: 11px;
}

#bd-app .bd-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  #bd-app .bd-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- empty state ---------- */
#bd-app .bd-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 44px 24px;
  background: var(--bg);
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
#bd-app .bd-empty:hover,
#bd-app .bd-empty.drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}
#bd-app .bd-empty:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#bd-app .bd-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#bd-app .bd-empty-title {
  margin: 10px 0 0;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}
#bd-app .bd-browse {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
#bd-app .bd-empty-hint {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.83rem;
}

/* ---------- panggung ---------- */
#bd-app .bd-stage-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
#bd-app .bd-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
#bd-app .bd-stage.drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}
#bd-app .bd-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
}
#bd-app .bd-preview canvas {
  display: block;
  border-radius: 2px;
  box-shadow: 0 10px 30px rgba(var(--shadow-color), 0.16);
}
#bd-app .bd-stage-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
#bd-app .bd-dims {
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
#bd-app .bd-compare {
  background: none;
  border: 0;
  padding: 4px 6px;
  border-radius: 6px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}
#bd-app .bd-compare:hover {
  background: var(--bg);
}
#bd-app .bd-compare:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- inspector ---------- */
#bd-app .bd-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  position: sticky;
  top: 84px;
}
@media (max-width: 900px) {
  #bd-app .bd-side {
    position: static;
  }
  #bd-app .bd-stage {
    min-height: 260px;
    padding: 16px;
  }
}
#bd-app .bd-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#bd-app .bd-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
#bd-app .bd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
#bd-app .bd-num-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 700;
}
#bd-app .bd-num {
  width: 58px;
  padding: 4px 6px;
  text-align: right;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
#bd-app .bd-num:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
#bd-app .bd-range {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
#bd-app .bd-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
#bd-app .bd-preset {
  padding: 6px 4px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
#bd-app .bd-preset:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
#bd-app .bd-preset.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
#bd-app .bd-preset:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#bd-app .bd-swatches {
  display: flex;
  align-items: center;
  gap: 10px;
}
#bd-app .bd-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--c, #fff);
  cursor: pointer;
  padding: 0;
  position: relative;
}
#bd-app .bd-swatch.on {
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent);
  border-color: transparent;
}
#bd-app .bd-swatch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
#bd-app .bd-swatch-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--card);
  color: var(--muted);
}
#bd-app .bd-swatch-custom input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
#bd-app .bd-swatch-custom svg {
  pointer-events: none;
}

#bd-app .bd-out {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text);
}
#bd-app .bd-out b {
  font-weight: 700;
}
#bd-app .bd-out span {
  color: var(--muted);
}
#bd-app .bd-name {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#bd-app .bd-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
#bd-app .bd-cta {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
}
#bd-app .bd-cta-2 {
  width: 100%;
}
#bd-app .bd-note {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
}
#bd-app .bd-note svg {
  flex: none;
  margin-top: 1px;
}

/* ---------- status ---------- */
#bd-app .bd-status {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
#bd-app .bd-status:empty {
  display: none;
}
#bd-app .bd-status.ok {
  color: var(--good);
}
#bd-app .bd-status.err {
  color: var(--bad);
}
