﻿.grain-bundle-editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  pointer-events: none;
}

.grain-bundle-editor-backdrop[hidden] { display: none !important; }

.grain-bundle-editor-modal {
  width: min(1180px, 72vw);
  max-height: 92vh;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #d8dde3;
  border-radius: 14px;
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  position: relative;
}

.grain-bundle-editor-modal.is-window-positioned {
  position: fixed;
}

.grain-bundle-editor-modal.is-window-dragging {
  box-shadow: 0 30px 68px rgba(15, 23, 42, 0.26);
}

.grain-bundle-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  cursor: move;
  user-select: none;
}

.grain-bundle-editor-head-left {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.grain-bundle-editor-title {
  font-weight: 800;
  font-size: 14px;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grain-bundle-editor-subtitle {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grain-bundle-editor-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  cursor: default;
}

.grain-bundle-editor-btn {
  width: auto;
  margin: 0;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.grain-bundle-editor-btn:hover { background: #f8fafc; }

.grain-bundle-editor-close {
  width: 32px;
  height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.grain-bundle-editor-close:hover { background: #f8fafc; }

.grain-bundle-editor-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  padding: 12px;
  min-height: 0;
}

.grain-bundle-editor-stage-wrap {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
  min-width: 0;
}

.grain-bundle-editor-stage {
  display: block;
  width: 100%;
  height: auto;
  min-height: 420px;
}

.grain-bundle-editor-side {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f8fafc;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.grain-bundle-editor-side-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #334155;
}

.grain-bundle-editor-side-line strong { color: #0f172a; }

.grain-bundle-editor-hint {
  font-size: 12px;
  line-height: 1.35;
  color: #64748b;
}

.grain-bundle-editor-help {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.grain-bundle-editor-help-btn {
  width: 24px;
  height: 24px;
  min-height: 24px;
  margin: 0;
  border: 1px solid #94a3b8;
  border-radius: 999px;
  background: #ffffff;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.grain-bundle-editor-help-btn:hover {
  background: #f8fafc;
}

.grain-bundle-editor-help-btn[aria-expanded="true"] {
  border-color: #14b8a6;
  color: #0f766e;
  box-shadow: 0 0 0 2px rgba(20,184,166,.12);
}

.grain-bundle-editor-help-panel {
  width: 100%;
  border: 1px solid #d8dde3;
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  line-height: 1.35;
  padding: 8px 9px;
}

.grain-bundle-editor-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.grain-bundle-editor-list-item {
  width: 100%;
  margin: 0;
  text-align: left;
  border: 1px solid #d8dde3;
  border-radius: 8px;
  background: #fff;
  padding: 7px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.grain-bundle-editor-list-item:hover { background: #f8fafc; }
.grain-bundle-editor-list-item.is-active { border-color: #14b8a6; box-shadow: 0 0 0 2px rgba(20,184,166,.14); }

.grain-bundle-editor-list-title { font-size: 12px; font-weight: 700; color: #0f172a; }
.grain-bundle-editor-list-sub { font-size: 11px; color: #475569; line-height: 1.25; }

.gbe-stage-label {
  font-size: 12px;
  font-weight: 700;
  fill: #334155;
}

.gbe-link-line {
  stroke: #14b8a6;
  stroke-width: 2;
  stroke-dasharray: 6 4;
  stroke-linecap: round;
  opacity: 0.85;
  pointer-events: none;
}

.gbe-part-rect {
  opacity: 0.92;
}

.gbe-part-stroke {
  stroke: #1f2937;
  stroke-width: 1.4;
}

.gbe-part-stroke-selected {
  stroke: #0f766e;
  stroke-width: 2.2;
}

.gbe-part-label {
  fill: #0f172a;
  font-size: 12px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(248,250,252,.96);
  stroke-width: 3.2px;
}

.gbe-edge-label {
  fill: #0f172a;
  font-size: 11px;
  font-weight: 800;
  text-anchor: middle;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(248,250,252,.98);
  stroke-width: 2.6px;
}

@media (max-width: 980px) {
  .grain-bundle-editor-backdrop {
    justify-content: center;
  }

  .grain-bundle-editor-modal {
    width: min(1280px, 98vw);
  }

  .grain-bundle-editor-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .grain-bundle-editor-head-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .grain-bundle-editor-body {
    grid-template-columns: 1fr;
  }

  .grain-bundle-editor-stage {
    min-height: 300px;
  }
}
