.bs-lookup {
  flex: 1;
  min-width: 240px;
}

.bs-handle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.34rem 0.28rem 0.72rem;
  transition: border-color 0.15s var(--ease-out);
}

.bs-handle-row:focus-within {
  border-color: var(--accent);
}

.bs-at {
  color: var(--text-dim);
  font-weight: 600;
}

.bs-handle-row input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
}

.bs-handle-row input::-webkit-search-cancel-button {
  display: none;
}

.bs-size-pill {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.28rem 0.58rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.bs-stage {
  position: relative;
  min-height: 14rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 1.25rem;
  border-radius: var(--radius);
  background:
    repeating-conic-gradient(rgba(237, 241, 247, 0.025) 0% 25%, transparent 0% 50%) 50% / 20px 20px,
    var(--bg-elevated);
  border: 1px solid var(--border);
}

.bs-spinner {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(var(--accent-rgb), 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: bsSpin 0.7s linear infinite;
  z-index: 5;
}

@keyframes bsSpin {
  to { transform: rotate(360deg); }
}

.bs-card {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  margin: auto;
  border-radius: 6px;
  transition: opacity 0.16s var(--ease-out);
}

.bs-card.bs-updating {
  opacity: 0.45;
}

.bs-empty {
  max-width: 28rem;
  text-align: center;
  color: var(--text-muted);
}

.bs-empty-title {
  font-family: var(--font-display);
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.bs-empty p {
  font-size: 0.84rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.bs-error {
  font-size: 0.82rem;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

.bs-char-count {
  font-size: 0.76rem;
  font-weight: 600;
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: 5px;
  padding: 0.16rem 0.52rem;
  font-variant-numeric: tabular-nums;
}

.bs-char-count.over {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.34);
}

.bs-toolong {
  font-size: 0.79rem;
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: var(--radius-sm);
  padding: 0.48rem 0.72rem;
  margin-top: 0.6rem;
}

.bs-option-stack,
.bs-sliders-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.bs-sublabel {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.bs-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  max-height: 230px;
  overflow-y: auto;
}

.bs-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.36rem 0.62rem;
  border-radius: var(--radius-sm);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.79rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.14s var(--ease-out), background-color 0.14s var(--ease-out), color 0.14s var(--ease-out);
}

.bs-chip:hover {
  border-color: #3a4c6d;
  color: var(--text);
}

.bs-chip input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.bs-chip:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--text);
}

.bs-chip:has(input:disabled) {
  opacity: 0.42;
  cursor: not-allowed;
}

.bs-chip:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.bs-tier {
  width: 0.52rem;
  height: 0.52rem;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  background: #8d939a;
}

.bs-tier[data-tier="gold"] { background: #f0cf7b; }
.bs-tier[data-tier="silver"] { background: #c9ced4; }
.bs-tier[data-tier="bronze"] { background: #b0774a; }

.bs-disabled-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.72rem 0.85rem;
  margin-bottom: 0.85rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: var(--radius-sm);
  font-size: 0.79rem;
  color: #fde68a;
}

.bs-stats-disabled {
  opacity: 0.45;
  pointer-events: none;
}

@media (max-width: 820px) {
  .workspace {
    padding: 0 0.85rem;
    margin: 0.85rem auto 2rem;
  }
  .stage-card,
  .inspector-body {
    padding: 1rem;
  }
  .stage-top {
    flex-direction: column;
    align-items: stretch;
  }
  .stage-actions {
    justify-content: space-between;
  }
}

@media (max-width: 560px) {
  .embed-snippet-row {
    flex-direction: column;
    align-items: stretch;
  }
  .bs-code .segmented-control {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
  }
}
