/* Builder Page — Visual + DSL + NL Mode Switcher Layout */

.page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* ===== Top Toolbar ===== */

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.toolbarTitle {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.toolbarTitle svg {
  color: var(--color-primary);
}

.divider {
  width: 1px;
  height: 1.25rem;
  background: var(--color-border);
  margin: 0 var(--spacing-xs);
}

/* ===== Mode Switcher ===== */

.modeSwitcher {
  display: flex;
  align-items: center;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

.modeBtn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.modeBtn:hover {
  color: var(--color-text);
  background: var(--color-bg-elevated);
}

.modeBtnActive {
  composes: modeBtn;
  color: #000;
  background: var(--color-primary);
  font-weight: 600;
}

.modeBtnActive:hover {
  background: var(--color-primary-light);
  color: #000;
}

/* ===== Toolbar Buttons ===== */

.toolbarBtn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.toolbarBtn:hover {
  color: var(--color-text);
  border-color: var(--color-border-hover);
  background: var(--color-bg-elevated);
}

.toolbarBtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.toolbarBtnPrimary {
  composes: toolbarBtn;
  background: var(--color-primary);
  color: #000;
  border-color: var(--color-primary);
}

.toolbarBtnPrimary:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary-light);
  color: #000;
  box-shadow: var(--glow-primary);
}

.toolbarBtnDanger {
  composes: toolbarBtn;
}

.toolbarBtnDanger:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.toolbarRight {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

/* ===== WASM Status ===== */

.statusBadge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.statusReady {
  composes: statusBadge;
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
}

.statusLoading {
  composes: statusBadge;
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
}

.statusError {
  composes: statusBadge;
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.dotPulse {
  composes: dot;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== Main Content Area ===== */

.content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.editorArea {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-width: 0;
}

/* ===== Resize Handle ===== */

.resizeHandle {
  width: 6px;
  flex-shrink: 0;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  position: relative;
  z-index: 10;
  transition: background var(--transition-fast);
}

.resizeHandle:hover,
.resizeHandle:active {
  background: rgba(118, 185, 0, 0.12);
}

.resizeHandleLine {
  width: 2px;
  height: 32px;
  border-radius: 1px;
  background: var(--color-border);
  transition: background var(--transition-fast), height var(--transition-fast);
}

.resizeHandle:hover .resizeHandleLine,
.resizeHandle:active .resizeHandleLine {
  background: var(--color-primary);
  height: 48px;
}

.dragOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  cursor: col-resize;
}

/* ===== Global Output Panel ===== */

.outputPanel {
  /* width set via inline style */
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  border-left: 1px solid var(--color-border);
  overflow: hidden;
  min-width: 200px;
}

.outputPanelTabs {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 var(--spacing-xs);
  height: 34px;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.outputPanelTab {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  height: 100%;
}

.outputPanelTab:hover {
  color: var(--color-text);
  background: var(--color-bg-tertiary);
}

.outputPanelTabActive {
  composes: outputPanelTab;
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

.outputPanelCopyBtn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.outputPanelCopyBtn:hover {
  color: var(--color-text);
  border-color: var(--color-border-hover);
}

.outputPanelCloseBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.outputPanelCloseBtn:hover {
  color: var(--color-text);
  background: var(--color-bg-tertiary);
}

.outputPanelContent {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.outputPanelCode {
  padding: var(--spacing-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

.outputPanelError {
  padding: var(--spacing-md);
  color: var(--color-danger);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}

.outputPanelToggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  flex-shrink: 0;
  background: var(--color-bg-secondary);
  border: none;
  border-left: 1px solid var(--color-border);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.outputPanelToggle:hover {
  color: var(--color-text);
  background: var(--color-bg-tertiary);
}

.toolbarBtnActive {
  composes: toolbarBtn;
  background: rgba(118, 185, 0, 0.15);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* ===== Guide Drawer ===== */

.guideDrawerOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.35);
  animation: fadeIn 0.2s ease;
}

.guideDrawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  /* width set via inline style */
  min-width: 300px;
  max-width: 90vw;
  background: var(--color-bg);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.2);
  animation: slideInRight 0.25s ease;
}

.guideDrawerResizeHandle {
  position: absolute;
  top: 0;
  left: -3px;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background var(--transition-fast);
}

.guideDrawerResizeHandle:hover,
.guideDrawerResizeHandle:active {
  background: rgba(118, 185, 0, 0.12);
}

.guideDrawerResizeLine {
  width: 2px;
  height: 32px;
  border-radius: 1px;
  background: var(--color-border);
  transition: background var(--transition-fast), height var(--transition-fast);
}

.guideDrawerResizeHandle:hover .guideDrawerResizeLine,
.guideDrawerResizeHandle:active .guideDrawerResizeLine {
  background: var(--color-primary);
  height: 48px;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.guideDrawerHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  flex-shrink: 0;
}

.guideDrawerTitle {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.guideDrawerClose {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.guideDrawerClose:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text);
}

.guideDrawerBody {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ===== Visual Mode ===== */

.visualContainer {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.visualRow {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Left sidebar: entity list */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebarHome {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0.625rem var(--spacing-md);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border-bottom: 1px solid var(--color-border);
  user-select: none;
}

.sidebarHome:hover {
  background: var(--color-bg-elevated);
  color: var(--color-text);
}

.sidebarHome svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.sidebarHomeActive {
  composes: sidebarHome;
  background: rgba(118, 185, 0, 0.08);
  color: var(--color-primary);
  border-left: 2px solid var(--color-primary);
}

.sidebarHomeActive svg {
  color: var(--color-primary);
  opacity: 1;
}

.sidebarSection {
  display: flex;
  flex-direction: column;
}

.sidebarSectionHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-bg-tertiary);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background var(--transition-fast);
  user-select: none;
}

.sidebarSectionHeader:hover {
  background: var(--color-bg-elevated);
}

.sidebarSectionTitle {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.sidebarCount {
  font-size: 0.6875rem;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  background: rgba(118, 185, 0, 0.15);
  color: var(--color-primary);
  font-weight: 600;
}

.sidebarSectionChevron {
  width: 12px;
  height: 12px;
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
}

.sidebarSectionChevronOpen {
  transform: rotate(90deg);
}

.sidebarList {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
}

.sidebarItem {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0.5rem var(--spacing-md);
  padding-left: calc(var(--spacing-md) + var(--spacing-sm));
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border-bottom: 1px solid transparent;
}

.sidebarItem:hover {
  background: var(--color-bg-elevated);
  color: var(--color-text);
}

.sidebarItemActive {
  composes: sidebarItem;
  background: rgba(118, 185, 0, 0.08);
  color: var(--color-text);
  border-left: 2px solid var(--color-primary);
}

.sidebarItemIcon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.6;
}

.sidebarItemName {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
}

.sidebarItemType {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.sidebarAddBtn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem var(--spacing-md);
  padding-left: calc(var(--spacing-md) + var(--spacing-sm));
  font-size: var(--text-xs);
  color: var(--color-primary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
  text-align: left;
}

.sidebarAddBtn:hover {
  background: rgba(118, 185, 0, 0.08);
}

/* Right panel: editor / detail view */
.mainPanel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.mainPanelContent {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--spacing-lg);
  min-height: 0;
}

/* ===== Dashboard View (no selection) ===== */

.dashboard {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  width: 100%;
  max-width: 1200px;
  padding-bottom: var(--spacing-xl);
}

.dashboardHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
}

.dashboardTitle {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.dashboardTitle svg {
  color: var(--color-primary);
}

.dashboardBadge {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.dashboardBadgeOk {
  background: rgba(34, 197, 94, 0.12);
  color: rgb(34, 197, 94);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.dashboardBadgeErr {
  background: rgba(239, 68, 68, 0.12);
  color: rgb(239, 68, 68);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.statsGrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--spacing-md);
}

.statCard {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.statCard:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(118, 185, 0, 0.1);
}

.statLabel {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.statValue {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
  font-family: var(--font-mono);
}

.statIcon {
  width: 20px;
  height: 20px;
  color: var(--color-primary);
  margin-bottom: 0.125rem;
}

.statBadge {
  font-size: 0.5625rem;
  font-weight: 700;
  padding: 0.125rem 0.375rem;
  border-radius: 999px;
  width: fit-content;
  letter-spacing: 0.02em;
}

.statBadgeOk {
  background: rgba(34, 197, 94, 0.1);
  color: rgb(34, 197, 94);
}

.statBadgeEmpty {
  background: var(--color-bg-tertiary);
  color: var(--color-text-muted);
}

/* ── Dashboard Section ── */

.dashSection {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.dashSectionTitle {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Quick Actions ── */

.quickActions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--spacing-md);
}

.quickActionBtn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}

.quickActionBtn:hover {
  border-color: var(--color-primary);
  background: rgba(118, 185, 0, 0.1);
  color: var(--color-primary);
  box-shadow: 0 2px 12px rgba(118, 185, 0, 0.12);
  transform: translateY(-1px);
}

.quickActionBtn:active {
  transform: translateY(0);
  box-shadow: none;
}

.quickActionIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: rgba(118, 185, 0, 0.1);
  color: var(--color-primary);
  font-weight: 700;
  font-size: 1.125rem;
  flex-shrink: 0;
}

/* ── Route Map ── */

.routeMap {
  display: flex;
  flex-direction: column;
  gap: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.routeMapEntry {
  padding: 0.375rem 0;
}

.routeMapEntryLabel {
  font-weight: 700;
  color: var(--color-text);
  font-size: 0.8125rem;
}

.routeMapFlow {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-left: 0.5rem;
  border-left: 2px solid var(--color-border);
}

.routeMapBranch {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.375rem 0 0.375rem 0.75rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.routeMapBranch:hover {
  background: rgba(118, 185, 0, 0.04);
}

.routeMapCondition {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-secondary);
}

.routeMapCondIcon {
  color: var(--color-text-muted);
  flex-shrink: 0;
  font-weight: 400;
}

.routeMapCondText {
  color: rgb(168, 130, 255);
  font-size: 0.6875rem;
  word-break: break-all;
}

.routeMapTarget {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-left: 1.5rem;
}

.routeMapTargetArrow {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.routeMapRouteName {
  color: var(--color-primary);
  font-weight: 600;
}

.routeMapModel {
  color: rgb(96, 165, 250);
  font-weight: 500;
}

.routeMapEmpty {
  padding: 0.75rem;
  color: var(--color-text-muted);
  font-style: italic;
  font-family: var(--font-sans);
}

/* ── Entity List View ── */

.entityListPanel {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  padding: var(--spacing-lg);
  height: 100%;
  overflow-y: auto;
}

.entityListHeader {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.entityListTitle {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.entityListCount {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.125rem 0.5rem;
}

.entityListGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--spacing-md);
}

.entityListCard {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid var(--entity-accent, var(--color-primary));
}

.entityListCard:hover {
  border-color: var(--entity-accent, var(--color-primary));
  border-left-color: var(--entity-accent, var(--color-primary));
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.entityListCardHeader {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.entityListCardIcon {
  width: 16px;
  height: 16px;
  color: var(--entity-accent, var(--color-primary));
  flex-shrink: 0;
}

.entityListCardName {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entityListCardType {
  display: inline-block;
  width: fit-content;
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--entity-accent, var(--color-primary));
  background: color-mix(in srgb, var(--entity-accent, var(--color-primary)) 10%, transparent);
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.entityListCardDesc {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entityListCardArrow {
  position: absolute;
  right: var(--spacing-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  transition: all 0.2s ease;
  opacity: 0;
}

.entityListCard:hover .entityListCardArrow {
  opacity: 1;
  color: var(--entity-accent, var(--color-primary));
  transform: translateY(-50%) translateX(2px);
}

/* ── Mode Switcher Cards ── */

.dashModes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-sm);
}

.dashModeBtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: var(--spacing-md);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.dashModeBtn:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(118, 185, 0, 0.1);
}

.dashModeBtnIcon {
  font-size: 1.25rem;
}

.dashModeBtnLabel {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text);
}

.dashModeBtnDesc {
  font-size: 0.625rem;
  color: var(--color-text-muted);
}

/* ===== Entity Editor Panel ===== */

.editorPanel {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  width: 100%;
  padding-bottom: var(--spacing-lg);
}

.editorHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
}

.backBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.backBtn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: rgba(118, 185, 0, 0.08);
}

.editorTitle {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.editorBadge {
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(118, 185, 0, 0.15);
  color: var(--color-primary);
  font-weight: 600;
  font-family: var(--font-mono);
}

.editorActions {
  display: flex;
  gap: var(--spacing-sm);
}

/* Form fields */
.fieldGroup {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.fieldLabel {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fieldInput {
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
  font-family: var(--font-mono);
}

.fieldInput:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(118, 185, 0, 0.2);
}

.fieldSelect {
  composes: fieldInput;
  cursor: pointer;
}

/* ===== Custom Select Dropdown ===== */

.customSelect {
  position: relative;
  width: 100%;
}

.customSelectTrigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  font-family: var(--font-mono);
  cursor: pointer;
  user-select: none;
  width: 100%;
}

.customSelectTrigger:hover {
  border-color: var(--color-border-hover);
}

.customSelectTriggerOpen {
  composes: customSelectTrigger;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(118, 185, 0, 0.2);
}

.customSelectChevron {
  width: 12px;
  height: 12px;
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.customSelectChevronOpen {
  transform: rotate(180deg);
}

.customSelectDropdown {
  z-index: 9999;
  max-height: 240px;
  overflow-y: auto;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
  padding: 4px;
}

.customSelectOption {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.customSelectOption:hover {
  background: rgba(118, 185, 0, 0.08);
  color: var(--color-text);
}

.customSelectOptionActive {
  composes: customSelectOption;
  color: var(--color-primary);
  background: rgba(118, 185, 0, 0.12);
}

.customSelectOptionActive:hover {
  background: rgba(118, 185, 0, 0.18);
}

.customSelectCheck {
  width: 14px;
  height: 14px;
  color: var(--color-primary);
  flex-shrink: 0;
}

.customSelectPlaceholder {
  width: 14px;
  flex-shrink: 0;
}

.fieldTextarea {
  composes: fieldInput;
  min-height: 80px;
  resize: vertical;
}

/* ===== Expression Builder ===== */

.exprDisplay {
  padding: 0.75rem;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  min-height: 2.5rem;
  display: flex;
  align-items: center;
}

.exprCode {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-primary);
  word-break: break-all;
  line-height: 1.5;
}

.exprPlaceholder {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-style: italic;
}

.exprSection {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.exprSectionLabel {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.exprPalette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.exprChip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0;
  line-height: 1;
}

.exprChip:hover {
  border-color: var(--color-primary);
  background: rgba(118, 185, 0, 0.08);
}

.exprChipType {
  font-size: 0.5625rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.exprChipName {
  font-size: 0.6875rem;
  color: var(--color-text);
  font-family: var(--font-mono);
}

.exprOpBtn {
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.exprOpBtn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: rgba(118, 185, 0, 0.08);
}

.exprOpBtnDanger {
  composes: exprOpBtn;
}

.exprOpBtnDanger:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
  background: rgba(239, 68, 68, 0.08);
}

/* ===== Model Name Combo Input ===== */

.modelDropdownBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-left: none;
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.modelDropdownBtn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: rgba(118, 185, 0, 0.08);
}

/* ===== Model Card ===== */

.modelCard {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  transition: border-color var(--transition-fast);
}

.modelCard:hover {
  border-color: var(--color-border-hover);
}

.modelCardHeader {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.modelIndex {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(118, 185, 0, 0.15);
  color: var(--color-primary);
  font-size: 0.625rem;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.modelAttrs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  align-items: center;
  padding-left: calc(20px + var(--spacing-sm));
  font-size: var(--text-xs);
}

.modelAttrCheck {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.modelAttrField {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.modelAttrLabel {
  font-size: 0.625rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ===== Plugin Toggle Panel ===== */

.pluginToggleGrid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.pluginToggle {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0;
  line-height: 1;
}

.pluginToggle:hover {
  border-color: var(--color-border-hover);
  background: var(--color-bg-elevated);
}

.pluginToggleActive {
  composes: pluginToggle;
  border-color: var(--color-primary);
  background: rgba(118, 185, 0, 0.1);
}

.pluginToggleActive:hover {
  background: rgba(118, 185, 0, 0.15);
}

.pluginToggleCheck {
  font-size: 0.6875rem;
  font-weight: 600;
  width: 14px;
  text-align: center;
}

.pluginToggle .pluginToggleCheck {
  color: var(--color-text-muted);
}

.pluginToggleActive .pluginToggleCheck {
  color: var(--color-primary);
}

.pluginToggleName {
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--color-text);
}

.pluginToggleType {
  font-size: 0.5625rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.pluginOverride {
  padding: var(--spacing-sm);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-sm);
}

.pluginOverrideHeader {
  margin-bottom: var(--spacing-sm);
}

/* DSL Preview in the right panel */
.dslPreview {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.dslPreviewHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-xs) var(--spacing-md);
  background: var(--color-bg-tertiary);
  border-bottom: 1px solid var(--color-border);
}

.dslPreviewTitle {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dslPreviewCode {
  padding: var(--spacing-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
}

/* ===== DSL Mode Container ===== */

.dslModeContainer {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== NL Mode Placeholder ===== */

.nlPlaceholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  text-align: center;
  padding: var(--spacing-xl);
}

.nlPlaceholderIcon {
  font-size: 3rem;
  opacity: 0.3;
}

.nlPlaceholderTitle {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-secondary);
}

/* ===== Status Bar ===== */

.statusBar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 var(--spacing-md);
  height: 26px;
  background: var(--color-bg-tertiary);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
}

.statusItem {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0 0.75rem;
  height: 100%;
  border-right: 1px solid var(--color-border);
  white-space: nowrap;
}

.statusItem:first-child {
  padding-left: 0;
}

.statusItem:last-child {
  border-right: none;
}

.statusValid {
  color: var(--color-success);
}

.statusInvalid {
  color: var(--color-danger);
}

.statusCheckmark {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* ===== Empty state ===== */

.emptyState {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  gap: var(--spacing-sm);
  padding: var(--spacing-xl);
  text-align: center;
}

.emptyIcon {
  font-size: 2rem;
  opacity: 0.5;
}

/* ===== WASM loading overlay ===== */

.wasmOverlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10;
  gap: var(--spacing-md);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== Responsive ===== */

@media (max-width: 768px) {
  .visualContainer {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .outputPanel {
    width: 100%;
    max-height: 300px;
    border-left: none;
    border-top: 1px solid var(--color-border);
  }
}

/* ===================================================================
   Import YAML Modal
   =================================================================== */

.modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  width: min(600px, 90vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modalTitle {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.modalClose {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modalClose:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text);
}

.modalBody {
  padding: var(--spacing-md) var(--spacing-lg);
  flex: 1;
  overflow: auto;
}

.modalHint {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin: 0 0 var(--spacing-sm);
  line-height: 1.5;
}

.importUrlRow {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.importUrlInput {
  flex: 1;
  padding: 0.375rem 0.625rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast);
}

.importUrlInput:focus {
  border-color: var(--color-primary);
}

.importUrlInput::placeholder {
  color: var(--color-text-muted);
}

.importTextarea {
  width: 100%;
  height: 280px;
  padding: var(--spacing-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  resize: vertical;
  outline: none;
  transition: border-color var(--transition-fast);
}

.importTextarea:focus {
  border-color: var(--color-primary);
}

.importTextarea::placeholder {
  color: var(--color-text-muted);
}

.importError {
  margin-top: var(--spacing-sm);
  font-size: var(--text-xs);
  color: var(--color-danger);
}

.modalFooter {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modalFooterImportActions {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.modalFooterPrimaryActions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

/* ===== Validation Panel (Visual Mode) ===== */

.validationPanel {
  flex-shrink: 0;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  max-height: 260px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.validationHeader {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0.375rem var(--spacing-md);
  background: var(--color-bg-tertiary);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.validationHeader:hover {
  background: var(--color-bg-elevated);
}

.validationTitle {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.validationTitle svg {
  color: var(--color-primary);
}

.validationCounts {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  margin-left: auto;
}

.valCountError {
  font-size: 0.6875rem;
  padding: 0.0625rem 0.375rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
}

.valCountWarn {
  font-size: 0.6875rem;
  padding: 0.0625rem 0.375rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
}

.valCountConstraint {
  font-size: 0.6875rem;
  padding: 0.0625rem 0.375rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
}

.validationChevron {
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
  margin-left: var(--spacing-xs);
}

.validationChevronOpen {
  transform: rotate(180deg);
}

.validationBody {
  overflow-y: auto;
  flex: 1;
  padding: var(--spacing-xs) 0;
}

.valGroup {
  padding: 0 var(--spacing-md) var(--spacing-xs);
}

.valGroupTitle {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0;
  margin-bottom: 0.125rem;
}

.valIconError {
  width: 12px;
  height: 12px;
  color: var(--color-danger);
  flex-shrink: 0;
}

.valIconWarn {
  width: 12px;
  height: 12px;
  color: var(--color-warning);
  flex-shrink: 0;
}

.valIconConstraint {
  width: 12px;
  height: 12px;
  color: #f97316;
  flex-shrink: 0;
}

.valItem {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.25rem 0 0.25rem 1.125rem;
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--color-text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.valItem:last-child {
  border-bottom: none;
}

.valMessage {
  flex: 1;
  word-break: break-word;
}

.valFixBtn {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0.0625rem 0.375rem;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--color-primary);
  background: rgba(118, 185, 0, 0.12);
  border: 1px solid rgba(118, 185, 0, 0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.valFixBtn:hover {
  background: rgba(118, 185, 0, 0.25);
  border-color: var(--color-primary);
  color: #fff;
}

/* ===== Global Settings Editor ===== */

.globalEditor {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.globalSaveBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.globalSaveHint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Section container */
.gsSection {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  overflow: hidden;
}

.gsSectionHeader {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0.625rem var(--spacing-md);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

.gsSectionHeader:hover {
  background: var(--color-bg-tertiary);
}

.gsSectionChevron {
  transition: transform 0.15s ease;
  flex-shrink: 0;
  color: var(--color-text-muted);
}

.gsSectionChevron[data-open="true"] {
  transform: rotate(90deg);
}

.gsSectionTitle {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: 0.01em;
}

.gsSectionBody {
  padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  border-top: 1px solid var(--color-border);
}

/* Form row */
.gsRow {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  min-height: 2rem;
}

.gsLabel {
  min-width: 160px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.gsSmallLabel {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* Radio group */
.gsRadioGroup {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.gsRadio {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--text-xs);
  color: var(--color-text);
  cursor: pointer;
}

.gsRadio input[type="radio"] {
  accent-color: var(--color-primary);
  margin: 0;
  cursor: pointer;
}

/* Checkbox */
.gsCheckbox {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--text-xs);
  color: var(--color-text);
  cursor: pointer;
}

.gsCheckbox input[type="checkbox"] {
  accent-color: var(--color-primary);
  margin: 0;
  cursor: pointer;
}

/* Inline row */
.gsInlineRow {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.gsInlineField {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

/* Sub-sections (Prompt Guard, Hallucination, etc.) */
.gsSubSection {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-primary);
  overflow: hidden;
}

.gsSubHeader {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0.5rem var(--spacing-md);
  background: var(--color-bg-tertiary);
  border-bottom: 1px solid transparent;
}

.gsSubTitle {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
}

.gsSubBody {
  padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  border-top: 1px solid var(--color-border);
}

/* Count badge */
.gsCountBadge {
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background: rgba(118, 185, 0, 0.12);
  color: var(--color-primary);
  margin-left: auto;
}

/* Endpoints table */
.gsEndpointTable {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: var(--text-xs);
}

.gsEndpointHeader {
  display: grid;
  grid-template-columns: 1fr 1.5fr 0.75fr 0.5fr;
  gap: var(--spacing-sm);
  padding: 0.375rem var(--spacing-md);
  background: var(--color-bg-tertiary);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.625rem;
  border-bottom: 1px solid var(--color-border);
}

.gsEndpointRow {
  display: grid;
  grid-template-columns: 1fr 1.5fr 0.75fr 0.5fr;
  gap: var(--spacing-sm);
  padding: 0.375rem var(--spacing-md);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
}

.gsEndpointRow:last-child {
  border-bottom: none;
}

.gsEndpointRow:hover {
  background: var(--color-bg-tertiary);
}

.gsEndpointName {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--color-primary);
}

.gsEndpointAddr {
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
}

.gsEndpointType {
  font-family: var(--font-mono);
}

.gsEmptyHint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding: var(--spacing-md);
  text-align: center;
}

.gsEndpointHint {
  font-size: 0.625rem;
  color: var(--color-text-muted);
  margin-top: var(--spacing-sm);
  padding: 0 var(--spacing-sm);
}

/* ===================================================================
   Deploy UI
   =================================================================== */

.toolbarBtnDeploy {
  composes: toolbarBtnPrimary;
}

/* Deploy Confirmation Modal */

.deployModal {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  width: min(440px, 90vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* Deploy Diff Modal — wider to accommodate side-by-side diff */

.deployDiffModal {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  width: min(1200px, 95vw);
  height: min(80vh, 900px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.deployDiffBody {
  flex: 1;
  min-height: 0;
  position: relative;
  border-bottom: 1px solid var(--color-border);
}

.deployDiffLoading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  height: 100%;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.deployDiffError {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-error);
  font-size: var(--text-sm);
  padding: var(--spacing-lg);
}

.deployDiffLabels {
  display: flex;
  align-items: center;
  font-size: var(--text-xs);
  font-weight: 400;
}

.deployDiffLabelOld {
  color: var(--color-error, #f87171);
  background: rgba(248, 113, 113, 0.1);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.deployDiffLabelNew {
  color: var(--color-success, #34d399);
  background: rgba(52, 211, 153, 0.1);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.deployModalHeader {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.deployModalBody {
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.deployModalBody p {
  margin: 0;
}

.deployModalFooter {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--color-border);
}

/* Diff Navigation Bar */

.deployDiffNav {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 4px var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-tertiary, var(--color-bg-secondary));
}

.deployDiffNavBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.deployDiffNavBtn:hover {
  background: var(--color-bg-hover, var(--color-bg));
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

.deployDiffNavInfo {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-left: var(--spacing-xs);
  user-select: none;
}

/* Deploy Progress Toast */

.deployToast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 10000;
  min-width: 280px;
  max-width: 400px;
}

.deployProgress {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.deployStepList {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.deployStepItem {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}

.deployStepActive {
  color: var(--color-text);
}

.deployStepDone {
  color: var(--color-success);
}

.deployStepError {
  color: var(--color-danger);
}

.deployStepIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.deployStepSpinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.deployStepPending {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
}

.deployStepLabel {
  font-weight: 500;
}

/* Deploy Result Toast */

.deployResultSuccess {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-success);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  font-size: var(--text-xs);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.deployResultError {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-danger);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  font-size: var(--text-xs);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.deployResultIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
}

.deployResultSuccess .deployResultIcon {
  color: var(--color-success);
}

.deployResultError .deployResultIcon {
  color: var(--color-danger);
}

.deployResultMsg {
  flex: 1;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-text);
}

.deployResultDismiss {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  opacity: 1;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.deployResultDismiss:hover {
  background: var(--color-bg-elevated);
  border-color: var(--color-border-hover);
  color: var(--color-text);
}
