.topovec-composite-widget {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 0.8rem;
  color: var(--marimo-text-color, #1f2937);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.topovec-composite-main {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
  gap: 1.05rem;
  align-items: stretch;
  min-width: 0;
}

.topovec-composite-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.topovec-composite-panel-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.2rem;
  display: grid;
  gap: 0.28rem;
  align-content: start;
}

.topovec-camera-viewer {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 0.6rem;
  color: var(--marimo-text-color, #1f2937);
}

.topovec-camera-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.topovec-camera-viewer[data-show-toolbar="false"] .topovec-camera-toolbar {
  display: none;
}

.topovec-camera-toolbar button,
.topovec-composite-action {
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: rgba(248, 250, 252, 0.92);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font: inherit;
  cursor: pointer;
}

.topovec-camera-toolbar button:hover,
.topovec-composite-action:hover,
.topovec-composite-section > summary:hover {
  background: rgba(226, 232, 240, 0.95);
}

.topovec-camera-status {
  min-height: 1.2rem;
  flex: 1 1 100%;
  font-size: 0.74rem;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
  opacity: 0.8;
}

.topovec-camera-viewport {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.88), rgba(226, 232, 240, 0.82)),
    linear-gradient(135deg, rgba(226, 232, 240, 0.92), rgba(241, 245, 249, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 10px 30px rgba(15, 23, 42, 0.08);
  cursor: grab;
  touch-action: none;
}

.topovec-camera-viewer[data-drag-mode="pan"] .topovec-camera-viewport {
  cursor: move;
}

.topovec-camera-viewer[data-drag-mode="rotate"] .topovec-camera-viewport,
.topovec-camera-viewer[data-drag-mode="roll"] .topovec-camera-viewport {
  cursor: grabbing;
}

.topovec-camera-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}

.topovec-camera-busy {
  position: absolute;
  right: 0.9rem;
  top: 0.9rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: white;
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 120ms ease, transform 120ms ease;
  pointer-events: none;
}

.topovec-camera-viewer[data-busy="true"] .topovec-camera-busy {
  opacity: 1;
  transform: translateY(0);
}

.topovec-camera-help {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  max-width: calc(100% - 1.5rem);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.82);
  color: rgba(15, 23, 42, 0.84);
  padding: 0.28rem 0.5rem;
  font-size: 0.68rem;
  line-height: 1.25;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  pointer-events: none;
  transition: opacity 120ms ease;
}

.topovec-camera-viewer[data-help-visible="false"] .topovec-camera-help {
  opacity: 0;
}

.topovec-composite-selector,
.topovec-composite-section,
.topovec-composite-summary {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.topovec-composite-selector,
.topovec-composite-summary,
.topovec-composite-section-body {
  padding: 0.52rem 0.62rem;
}

.topovec-composite-section > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.48rem 0.62rem;
  border-radius: 16px;
  user-select: none;
  font-size: 0.76rem;
  line-height: 1.15;
}

.topovec-composite-section > summary::-webkit-details-marker {
  display: none;
}

.topovec-composite-section[open] > summary {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.topovec-composite-rows {
  display: grid;
  gap: 0.18rem;
  align-content: start;
}

.topovec-composite-row {
  display: grid;
  grid-template-columns: minmax(0, 5.6rem) minmax(0, 1fr);
  gap: 0.44rem;
  align-items: start;
}

.topovec-composite-row-stack {
  grid-template-columns: minmax(0, 1fr);
  gap: 0.12rem;
}

.topovec-composite-row-label {
  display: block;
  font-size: 0.71rem;
  line-height: 1.12;
  opacity: 0.74;
  overflow-wrap: anywhere;
  word-break: break-word;
  padding-top: 0.08rem;
}

.topovec-composite-row-control {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.topovec-composite-row-stack .topovec-composite-row-control {
  display: block;
}

.topovec-composite-label,
.topovec-composite-summary-label {
  display: block;
  font-size: 0.72rem;
  line-height: 1.15;
  opacity: 0.76;
}

.topovec-composite-select,
.topovec-composite-number,
.topovec-composite-summary-text,
.topovec-composite-action {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.topovec-composite-select,
.topovec-composite-number,
.topovec-composite-summary-text {
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  font: inherit;
  color: inherit;
  padding: 0.34rem 0.46rem;
}

.topovec-composite-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.8rem;
  gap: 0.32rem;
  align-items: center;
}

.topovec-composite-range-input {
  width: 100%;
  min-width: 0;
}

.topovec-composite-checkbox {
  inline-size: 1rem;
  block-size: 1rem;
  margin: 0;
}

.topovec-composite-note {
  font-size: 0.71rem;
  line-height: 1.25;
  opacity: 0.76;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.topovec-composite-summary-text {
  resize: vertical;
  min-height: 4.6rem;
  background: rgba(248, 250, 252, 0.82);
}

@media (max-width: 960px) {
  .topovec-composite-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .topovec-composite-panel {
    min-height: 22rem;
  }
}
