/* Project Groups: Single-Row Workspace Switcher, Management Page & Canvas Lock Banner */
.pg-sidebar-spaces {
  position: relative;
  padding: 6px 4px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 8px;
}
.pg-space-switcher-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
}
.pg-space-trigger {
  flex: 1;
  min-width: 0;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.pg-space-trigger:hover,
.pg-sidebar-spaces.is-open .pg-space-trigger {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}
.pg-space-trigger .pg-space-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pg-space-caret {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.56);
  transition: transform 0.16s ease;
}
.pg-sidebar-spaces.is-open .pg-space-caret {
  transform: rotate(180deg);
}
.pg-space-popover {
  position: absolute;
  left: 4px;
  right: 4px;
  top: calc(100% - 2px);
  z-index: 80;
  background: #1e1f23;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.54);
  padding: 6px;
}
.pg-space-popover[hidden] {
  display: none;
}
.pg-space-popover-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 240px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
@media (max-height: 620px) {
  .pg-space-popover-list {
    max-height: max(120px, calc(100dvh - 220px));
  }
}
.pg-space-popover-foot {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.pg-space-create-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
.pg-space-create-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.pg-space-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pg-space-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pg-space-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.pg-space-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}
.pg-space-btn.active {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 600;
}
.pg-space-btn .pg-space-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pg-space-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6c8cff;
  flex-shrink: 0;
}
.pg-space-dot.personal {
  background: #38d39f;
}
.pg-space-gear {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.52);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pg-space-gear:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.nav-collapsed .pg-sidebar-spaces {
  display: none;
}

.pg-header-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(108, 140, 255, 0.16);
  border: 1px solid rgba(108, 140, 255, 0.35);
  color: #dbe4ff;
  cursor: pointer;
  margin-right: 10px;
  max-width: 180px;
  min-width: 0;
  flex-shrink: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pg-header-pill:hover {
  background: rgba(108, 140, 255, 0.25);
}
.pg-header-pill.suspended {
  background: rgba(255, 168, 76, 0.16);
  border-color: rgba(255, 168, 76, 0.4);
  color: #ffd7a8;
}

.pg-canvas-lock-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(255, 168, 76, 0.16);
  border-bottom: 1px solid rgba(255, 168, 76, 0.35);
  color: #ffdfb8;
  font-size: 13px;
}
.pg-canvas-lock-banner .grow {
  flex: 1;
}

.pg-page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 28px 60px;
}
.pg-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.pg-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.pg-tab {
  padding: 9px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  cursor: pointer;
}
.pg-tab.active {
  color: #fff;
  border-bottom-color: #6c8cff;
  font-weight: 600;
}
.pg-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.pg-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 16px;
}
.pg-card h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 500;
}
.pg-card .pg-big {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
}
.pg-card .pg-big.pg-big-text {
  font-size: 20px;
  color: #8df0cc;
}
.pg-card .pg-role-value {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pg-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
}
.pg-panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
}
.pg-form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.pg-form-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}
.pg-form-row input,
.pg-form-row select {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
}
.pg-invite-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(56, 211, 159, 0.1);
  border: 1px solid rgba(56, 211, 159, 0.35);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pg-invite-box code {
  flex: 1;
  min-width: 220px;
  word-break: break-all;
  font-size: 12px;
  color: #b8ffe3;
}
.pg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.pg-table th,
.pg-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}
.pg-table th {
  color: rgba(255, 255, 255, 0.58);
  font-weight: 500;
}
.pg-invite-landing {
  max-width: 480px;
  margin: 64px auto;
  padding: 28px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
}
.pg-role-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  letter-spacing: 0.02em;
}
.pg-role-matrix tr.is-me td {
  background: rgba(108, 140, 255, 0.1);
}
.pg-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.pg-panel-head h2 {
  margin: 0;
}
.pg-preset-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.pg-preset-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pg-preset-pill strong {
  font-size: 13px;
  color: #fff;
}
.pg-preset-pill span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62);
}
.pg-preset-pill:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.24);
}
.pg-preset-pill.active {
  background: rgba(108, 140, 255, 0.16);
  border-color: rgba(108, 140, 255, 0.55);
}
.pg-role-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pg-role-editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 156px;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.pg-role-editor-cap {
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.78);
}
.pg-role-editor-row input {
  width: 100%;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
}
.native-project-card-wrap {
  position: relative;
  min-width: 0;
}
.pg-card-menu {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
}
.pg-card-menu > summary {
  list-style: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 18, 22, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.native-project-card-wrap:hover .pg-card-menu > summary,
.native-project-card-wrap:focus-within .pg-card-menu > summary,
.pg-card-menu[open] > summary {
  opacity: 1;
}
.pg-card-menu > summary:hover {
  background: rgba(34, 34, 42, 0.96);
  color: #fff;
}
.pg-card-menu > summary::-webkit-details-marker {
  display: none;
}
.pg-card-menu > div[role="menu"] {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 152px;
  padding: 6px;
  border-radius: 10px;
  background: #202026;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.48);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 10;
}
.pg-card-menu > div[role="menu"] > button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  padding: 7px 10px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  cursor: pointer;
}
.pg-card-menu > div[role="menu"] > button:hover {
  background: rgba(255, 255, 255, 0.08);
}
.pg-card-menu > div[role="menu"] > button.danger {
  color: #ff8e8e;
}
/* Ensure prompt text and notes inside canvas nodes stay selectable & copyable (incl. T4 viewer) */
.canvas-node-body p,
.canvas-note-text,
.canvas-inspector textarea,
[data-asset-canvas-prompt] {
  user-select: text;
  -webkit-user-select: text;
}

/* Read-only canvas floating protection pill + 1-click clone & collaborator actions */
#pg-canvas-readonly-host {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 28;
  max-width: calc(100% - 32px);
  pointer-events: none;
}
.pg-canvas-readonly-bar {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 14px;
  border-radius: 999px;
  background: rgba(24, 25, 31, 0.92);
  border: 1px solid rgba(124, 152, 255, 0.36);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  color: #f3f5ff;
  font-size: 12.5px;
  line-height: 1.3;
  white-space: nowrap;
}
.pg-readonly-title {
  font-weight: 600;
  color: #ffffff;
}
.pg-readonly-hint {
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
}
@media (max-width: 860px) {
  .pg-readonly-hint {
    display: none;
  }
}
.pg-readonly-clone-btn {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(108, 140, 255, 0.55);
  background: #4e73ff;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}
.pg-readonly-clone-btn:hover {
  background: #6183ff;
}
.pg-readonly-collab-btn {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.pg-readonly-collab-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}

/* Mode B: Group-level canvas collaboration mode cards */
.pg-settings-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.pg-collab-mode-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pg-collab-mode-label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
}
.pg-collab-mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}
.pg-collab-mode-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.24);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pg-collab-mode-card:hover {
  border-color: rgba(255, 255, 255, 0.24);
}
.pg-collab-mode-card.is-selected {
  border-color: rgba(108, 140, 255, 0.65);
  background: rgba(108, 140, 255, 0.11);
}
.pg-collab-mode-card input[type="radio"] {
  margin-top: 3px;
}
.pg-collab-mode-card strong {
  display: block;
  font-size: 13px;
  color: #fff;
  margin-bottom: 3px;
}
.pg-collab-mode-card small {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.45;
}

/* Mode A: Per-project co-editor modal */
.pg-collab-mode-notice {
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(108, 140, 255, 0.12);
  border: 1px solid rgba(108, 140, 255, 0.32);
  color: #dbe4ff;
  font-size: 12px;
}
.pg-collab-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 340px;
  overflow-y: auto;
}
.pg-collab-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.pg-collab-member {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.pg-collab-member strong {
  font-size: 13px;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pg-collab-role {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
  font-size: 11.5px;
  flex-shrink: 0;
}
.pg-collab-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
}

.pg-invite-head {
  flex-wrap: wrap;
}
#pg-invite-form label {
  min-width: 0;
}
#pg-invite-form #pg-invite-role {
  max-width: 242px;
}
#pg-invite-form #pg-invite-project {
  max-width: 192px;
}
#pg-invite-form #pg-invite-max-uses {
  max-width: 204px;
}
#pg-invite-form input[name="note"] {
  width: 162px;
}
.pg-invite-mode-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.12);
  gap: 2px;
}
.pg-invite-mode-btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.pg-invite-mode-btn:hover:not(:disabled) {
  color: #fff;
}
.pg-invite-mode-btn.is-active {
  background: rgba(108, 140, 255, 0.24);
  color: #fff;
  font-weight: 600;
}
.pg-invite-mode-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
.pg-invite-lock-hint {
  margin: 8px 0 0;
  color: #ffd7a8;
}
.pg-invite-summary-pill {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(56, 211, 159, 0.18);
  border: 1px solid rgba(56, 211, 159, 0.35);
  color: #d9fff0;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pg-invite-status-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pg-invite-meta-tag {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.66);
}
.pg-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
