/* ==========================================================================
   psge.css — Problem Solving Graph Engine
   Visual concept: galaxy neuro-grid, 220px sidebar, full-width topbar
   ========================================================================== */

/* ── Custom properties ─────────────────────────────────────────────────────── */
:root {
  --psge-bg:          #07080f;
  --psge-bg-panel:    rgba(12, 14, 28, 0.88);
  --psge-bg-card:     rgba(18, 20, 38, 0.92);
  --psge-border:      rgba(255, 255, 255, 0.07);
  --psge-border-hover:rgba(255, 255, 255, 0.14);

  --psge-accent:      #8b5cf6;
  --psge-accent-glow: rgba(139, 92, 246, 0.4);
  --psge-blue:        #3b82f6;
  --psge-green:       #10b981;
  --psge-text:        #e2e8f0;
  --psge-text-muted:  #94a3b8;
  --psge-text-dim:    #475569;

  --psge-sidebar-w:   220px;
  --psge-right-w:     300px;
  --psge-bottom-h:    86px;
  --psge-topbar-h:    60px;

  /* Cluster color tokens */
  --cluster-primary:  #8b5cf6;
  --cluster-green:    #22c55e;
  --cluster-teal:     #06b6d4;
  --cluster-magenta:  #ec4899;
  --cluster-purple:   #a855f7;
  --cluster-orange:   #f97316;
  --cluster-blue:     #3b82f6;
  --cluster-yellow:   #eab308;
  --cluster-pink:     #f472b6;
  --cluster-rose:     #f43f5e;
  --cluster-amber:    #f59e0b;
  --cluster-cyan:     #22d3ee;
}

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* Override critical.css body defaults for the PSGE standalone page */
body.psge-page,
.psge-page {
  font-family: "Inter", "Rubik", system-ui, sans-serif !important;
  background: var(--psge-bg) !important;
  background-color: var(--psge-bg) !important;
  color: var(--psge-text) !important;
  min-height: 100vh;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HOME SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */

.psge-home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
}

.psge-home::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(139, 92, 246, 0.10) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.07) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.psge-home__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.psge-home__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.08);
  color: #c4b5fd;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.psge-home__badge span { opacity: 0.7; }

.psge-home__title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  text-align: center;
  line-height: 1.15;
  margin: 0;
  background: linear-gradient(135deg, #e2e8f0 30%, #8b5cf6 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.psge-home__subtitle {
  font-size: 16px;
  color: var(--psge-text-muted);
  text-align: center;
  line-height: 1.6;
  margin: 0;
  max-width: 540px;
}

/* Input */
.psge-input-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.psge-input-box {
  width: 100%;
  background: rgba(18, 20, 38, 0.95);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 14px;
  padding: 16px 20px;
  color: var(--psge-text);
  font-size: 15px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.6;
}

.psge-input-box::placeholder { color: var(--psge-text-dim); }
.psge-input-box:focus {
  border-color: var(--psge-accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.psge-input-submit {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  padding: 10px 22px;
  border-radius: 10px;
  background: var(--psge-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.psge-input-submit:hover {
  background: #7c3aed;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

/* Chips */
.psge-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.psge-chip {
  padding: 7px 14px;
  border-radius: 100px;
  border: 1px solid var(--psge-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--psge-text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.psge-chip:hover {
  border-color: var(--psge-accent);
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   GRAPH PAGE LAYOUT  —  topbar spans full width
   ═══════════════════════════════════════════════════════════════════════════ */

.psge-layout {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--psge-bg);
}

.psge-layout.is-visible { display: grid; }

.psge-layout {
  grid-template-areas:
    "topbar  topbar  topbar"
    "sidebar canvas  right"
    "sidebar bottom  bottom";
  grid-template-columns: var(--psge-sidebar-w) 1fr var(--psge-right-w);
  grid-template-rows: var(--psge-topbar-h) 1fr var(--psge-bottom-h);
}

/* ── Top bar (full width) ──────────────────────────────────────────────────── */
.psge-topbar {
  grid-area: topbar;
  background: rgba(6, 7, 15, 0.98);
  border-bottom: 1px solid var(--psge-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  z-index: 20;
}

/* Logo + wordmark */
.psge-topbar__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.psge-topbar__logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.psge-topbar__logo-icon img { width: 24px; height: 24px; object-fit: contain; }

.psge-topbar__logo-name {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fff;
  text-transform: uppercase;
}

.psge-topbar__vdivider {
  width: 1px;
  height: 22px;
  background: var(--psge-border);
  flex-shrink: 0;
}

.psge-topbar__breadcrumb {
  color: var(--psge-text-muted);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s;
}
.psge-topbar__breadcrumb:hover { color: var(--psge-text); }

/* PSGE Gateway pill (two-line title block) */
.psge-topbar__title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.16);
  border: 1px solid rgba(139, 92, 246, 0.35);
}

.psge-topbar__title-main {
  font-size: 13px;
  font-weight: 700;
  color: var(--psge-text);
  white-space: nowrap;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 5px;
}

.psge-topbar__title-sub {
  font-size: 10px;
  color: #a78bfa;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.psge-topbar__spacer { flex: 1; min-width: 0; }

.psge-ai-badge {
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.psge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  font-family: inherit;
}

.psge-btn--ghost {
  background: transparent;
  color: var(--psge-text-muted);
  border: 1px solid var(--psge-border);
}
.psge-btn--ghost:hover { background: rgba(255,255,255,0.05); color: var(--psge-text); }

.psge-btn--primary {
  background: var(--psge-accent);
  color: #fff;
}
.psge-btn--primary:hover { background: #7c3aed; box-shadow: 0 4px 12px rgba(139,92,246,0.35); }

.psge-btn svg { width: 14px; height: 14px; }

/* User avatar */
.psge-topbar__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: default;
  user-select: none;
}

/* ── Sidebar (220px, sectioned) ────────────────────────────────────────────── */
.psge-sidebar {
  grid-area: sidebar;
  background: rgba(6, 7, 15, 0.97);
  border-right: 1px solid var(--psge-border);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;
}

.psge-sidebar::-webkit-scrollbar { width: 3px; }
.psge-sidebar::-webkit-scrollbar-track { background: transparent; }
.psge-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

/* Section label */
.psge-sidebar__label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--psge-text-dim);
  padding: 10px 16px 4px;
}

/* Nav item (Quick Actions, AI Asistent) */
.psge-sidebar__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--psge-text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  width: 100%;
  text-align: left;
}

.psge-sidebar__item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--psge-text);
}

.psge-sidebar__item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
}

.psge-sidebar__item:hover svg { opacity: 1; }

/* Active PSGE card */
.psge-sidebar__active {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 10px;
  padding: 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(59, 130, 246, 0.10));
  border: 1px solid rgba(139, 92, 246, 0.3);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s;
}

.psge-sidebar__active:hover { border-color: rgba(139, 92, 246, 0.55); }

.psge-sidebar__active-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.psge-sidebar__active-icon svg {
  width: 16px;
  height: 16px;
  color: #c4b5fd;
}

.psge-sidebar__active-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--psge-text);
  line-height: 1.2;
}

.psge-sidebar__active-desc {
  font-size: 11px;
  color: var(--psge-text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

/* History items */
.psge-sidebar__hist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  color: var(--psge-text-muted);
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  border: none;
  background: none;
  font-family: inherit;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 0;
}

.psge-sidebar__hist-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--psge-text);
}

.psge-sidebar__hist-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.4;
}

.psge-sidebar__hist-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.psge-sidebar__show-all {
  padding: 5px 16px;
  font-size: 11px;
  color: var(--psge-accent);
  text-decoration: none;
  display: block;
  transition: color 0.15s;
}
.psge-sidebar__show-all:hover { color: #c4b5fd; }

/* Spacer */
.psge-sidebar__spacer { flex: 1; }

/* Bottom blurb */
.psge-sidebar__blurb {
  margin: 12px 10px 4px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.14);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.psge-sidebar__blurb-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.psge-sidebar__blurb-icon svg {
  width: 14px;
  height: 14px;
  color: #c4b5fd;
}

.psge-sidebar__blurb p {
  font-size: 11px;
  color: var(--psge-text-dim);
  line-height: 1.55;
  margin: 0;
}

/* ── Canvas area ───────────────────────────────────────────────────────────── */
.psge-canvas-wrap {
  grid-area: canvas;
  position: relative;
  overflow: hidden;
  background: var(--psge-bg);
}

/* Galaxy nebula background */
.psge-canvas-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 60% 50% at 35% 40%, rgba(139, 92, 246, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 70% 60%, rgba(59, 130, 246, 0.09) 0%, transparent 70%),
    radial-gradient(ellipse 40% 35% at 55% 20%, rgba(236, 72, 153, 0.06) 0%, transparent 65%),
    radial-gradient(circle at 20% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
    radial-gradient(rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 30px 30px;
  pointer-events: none;
  z-index: 0;
}

#psge-stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

#psge-cy {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: transparent;
}

/* ── Floating intent bar ───────────────────────────────────────────────────── */
.psge-intent-bar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 12px;
  background: rgba(12, 14, 28, 0.90);
  border: 1px solid rgba(139, 92, 246, 0.25);
  backdrop-filter: blur(16px);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  max-width: calc(100% - 160px);
  min-width: 280px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.psge-intent-bar:hover {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 4px 24px rgba(139, 92, 246, 0.2);
}

.psge-intent-bar__label {
  font-size: 11px;
  font-weight: 700;
  color: var(--psge-accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.psge-intent-bar__text {
  font-size: 14px;
  color: var(--psge-text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.psge-intent-bar svg {
  width: 14px;
  height: 14px;
  color: var(--psge-text-dim);
  flex-shrink: 0;
}

/* ── Floating view toggle (inside canvas) ──────────────────────────────────── */
.psge-view-toggle {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  gap: 2px;
  background: rgba(12, 14, 28, 0.90);
  border: 1px solid var(--psge-border);
  border-radius: 10px;
  padding: 4px;
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.psge-view-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--psge-text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.psge-view-toggle-btn svg { width: 14px; height: 14px; }

.psge-view-toggle-btn.active {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
}

.psge-view-toggle-btn.active svg { color: var(--psge-accent); }

/* Zoom controls */
.psge-zoom-controls {
  position: absolute;
  bottom: 20px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 5;
}

.psge-zoom-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--psge-border);
  background: rgba(12, 14, 28, 0.90);
  color: var(--psge-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  backdrop-filter: blur(12px);
  transition: background 0.15s, color 0.15s;
}
.psge-zoom-btn:hover { background: rgba(139,92,246,0.15); color: var(--psge-text); }

/* Loading overlay */
.psge-canvas-loading {
  position: absolute;
  inset: 0;
  background: var(--psge-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  gap: 20px;
  transition: opacity 0.4s;
}

.psge-canvas-loading.hidden { opacity: 0; pointer-events: none; }

.psge-loader-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid var(--psge-border);
  border-top-color: var(--psge-accent);
  animation: psge-spin 0.8s linear infinite;
}

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

.psge-canvas-loading p {
  color: var(--psge-text-muted);
  font-size: 14px;
  margin: 0;
}

/* ── Right panel ───────────────────────────────────────────────────────────── */
.psge-right {
  grid-area: right;
  background: var(--psge-bg-panel);
  border-left: 1px solid var(--psge-border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(20px);
}

.psge-right::-webkit-scrollbar { width: 4px; }
.psge-right::-webkit-scrollbar-track { background: transparent; }
.psge-right::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

.psge-panel-section {
  padding: 16px;
  border-bottom: 1px solid var(--psge-border);
}

.psge-panel-section:last-child { border-bottom: none; }

.psge-panel-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--psge-text-dim);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.psge-panel-label a {
  font-size: 11px;
  color: var(--psge-accent);
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.psge-panel-label a:hover { text-decoration: underline; }

/* Node detail header */
.psge-node-detail {
  padding: 14px 16px;
  border-bottom: 1px solid var(--psge-border);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.psge-node-detail__icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.psge-node-detail__info { min-width: 0; }

.psge-node-detail__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--psge-text);
  margin: 0 0 3px;
}

.psge-node-detail__desc {
  font-size: 12px;
  color: var(--psge-text-muted);
  margin: 0;
  line-height: 1.5;
}

.psge-node-detail__why {
  font-size: 11px;
  color: #6b7280;
  margin: 4px 0 0;
  line-height: 1.5;
}

/* Step card */
.psge-step-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.1s;
}
.psge-step-card:last-child { border-bottom: none; padding-bottom: 0; }
.psge-step-card:hover { background: rgba(255,255,255,0.02); margin: 0 -16px; padding-left: 16px; padding-right: 16px; border-radius: 8px; }

.psge-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.psge-step-body { flex: 1; min-width: 0; }

.psge-step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--psge-text);
  margin: 0 0 2px;
}

.psge-step-desc {
  font-size: 11px;
  color: var(--psge-text-muted);
  margin: 0;
  line-height: 1.5;
}

.psge-step-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #a78bfa;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
}
.psge-step-btn:hover { background: rgba(139, 92, 246, 0.22); border-color: rgba(139, 92, 246, 0.5); color: #c4b5fd; }
.psge-step-btn svg { width: 14px; height: 14px; }

/* Partner card */
.psge-partner-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  text-decoration: none;
  transition: background 0.1s;
  cursor: pointer;
}
.psge-partner-card:last-child { border-bottom: none; }
.psge-partner-card:hover { background: rgba(255,255,255,0.02); margin: 0 -16px; padding-left: 16px; padding-right: 16px; border-radius: 8px; }

.psge-partner-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--psge-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--psge-text-muted);
  overflow: hidden;
  flex-shrink: 0;
}

.psge-partner-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }

.psge-partner-info { flex: 1; min-width: 0; }

.psge-partner-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--psge-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.psge-partner-meta {
  font-size: 11px;
  color: var(--psge-text-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.psge-partner-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.psge-rating {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: #fbbf24;
  font-weight: 600;
  white-space: nowrap;
}

.psge-rating svg { width: 12px; height: 12px; }

.psge-reviews {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--psge-text-dim);
  white-space: nowrap;
}

.psge-reviews svg { width: 11px; height: 11px; }

.psge-no-partners {
  font-size: 12px;
  color: var(--psge-text-dim);
  padding: 8px 0 4px;
  line-height: 1.6;
}
.psge-no-partners a { color: var(--psge-accent); text-decoration: none; }
.psge-no-partners a:hover { text-decoration: underline; }

/* AI Insight */
.psge-ai-insight {
  padding: 14px;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.psge-ai-insight__label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #a78bfa;
  text-transform: uppercase;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.psge-ai-insight__text {
  font-size: 12px;
  color: var(--psge-text-muted);
  line-height: 1.7;
  margin: 0 0 12px;
}

.psge-ai-insight__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  background: rgba(139, 92, 246, 0.25);
  border: 1px solid rgba(139, 92, 246, 0.4);
  padding: 7px 12px;
  border-radius: 8px;
  font-family: inherit;
  transition: background 0.15s;
  width: 100%;
  justify-content: center;
}
.psge-ai-insight__cta:hover { background: rgba(139, 92, 246, 0.35); }
.psge-ai-insight__cta svg { width: 13px; height: 13px; }

/* ── Bottom bar (KORACI DO REALIZACIJE + timeline) ─────────────────────────── */
.psge-bottom {
  grid-area: bottom;
  background: rgba(6, 7, 15, 0.98);
  border-top: 1px solid var(--psge-border);
  display: flex;
  flex-direction: column;
  padding: 0;
  z-index: 10;
  overflow: hidden;
}

.psge-bottom__header {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--psge-text-dim);
  padding: 10px 20px 6px;
  flex-shrink: 0;
}

/* Phase timeline */
.psge-timeline {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 12px;
}
.psge-timeline::-webkit-scrollbar { height: 0; }

.psge-phase {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.psge-phase-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 40px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
  white-space: nowrap;
}
.psge-phase-item:hover { background: rgba(255,255,255,0.04); }
.psge-phase-item.active { background: rgba(139, 92, 246, 0.14); }
.psge-phase-item.active .psge-phase-num { background: var(--psge-accent); color: #fff; border-color: var(--psge-accent); }
.psge-phase-item.active .psge-phase-title { color: var(--psge-text); }

.psge-phase-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--psge-text-dim);
  color: var(--psge-text-dim);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.psge-phase-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--psge-text-muted);
}

.psge-phase-connector {
  width: 24px;
  height: 1px;
  background: linear-gradient(90deg, rgba(139,92,246,0.3), rgba(59,130,246,0.3));
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LISTA KORAKA VIEW
   ═══════════════════════════════════════════════════════════════════════════ */

.psge-lista-view {
  display: none;
  grid-area: canvas;
  overflow-y: auto;
  padding: 64px 20px 20px;
  background: var(--psge-bg);
}

.psge-lista-view.is-visible { display: block; }

.psge-lista-cluster {
  margin-bottom: 16px;
  border-radius: 12px;
  border: 1px solid var(--psge-border);
  overflow: hidden;
}

.psge-lista-cluster__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  background: rgba(18, 20, 38, 0.8);
  transition: background 0.15s;
}
.psge-lista-cluster__header:hover { background: rgba(18, 20, 38, 1); }

.psge-lista-cluster__color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.psge-lista-cluster__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--psge-text);
  flex: 1;
}

.psge-lista-cluster__toggle {
  color: var(--psge-text-dim);
  font-size: 14px;
  transition: transform 0.2s;
}
.psge-lista-cluster.expanded .psge-lista-cluster__toggle { transform: rotate(180deg); }

.psge-lista-cluster__body {
  display: none;
  padding: 4px 0 8px;
  background: rgba(12, 14, 28, 0.9);
}
.psge-lista-cluster.expanded .psge-lista-cluster__body { display: block; }

.psge-lista-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  transition: background 0.1s;
  cursor: pointer;
}
.psge-lista-item:hover { background: rgba(255,255,255,0.03); }

.psge-lista-item__title {
  font-size: 13px;
  color: var(--psge-text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   GRAPH NODE TOOLTIPS
   ═══════════════════════════════════════════════════════════════════════════ */

.psge-tooltip {
  position: fixed;
  z-index: 100;
  background: rgba(12, 14, 28, 0.97);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--psge-text);
  pointer-events: none;
  max-width: 220px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
}
.psge-tooltip.visible { opacity: 1; transform: translateY(0); }
.psge-tooltip__title { font-weight: 700; margin: 0 0 3px; }
.psge-tooltip__desc { color: var(--psge-text-muted); margin: 0; line-height: 1.5; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
  :root {
    --psge-sidebar-w: 180px;
    --psge-right-w:   260px;
  }
  .psge-topbar__logo-name { display: none; }
}

@media (max-width: 1024px) and (min-width: 768px) {
  :root {
    --psge-sidebar-w: 52px;
    --psge-right-w:   260px;
  }

  .psge-sidebar__label,
  .psge-sidebar__item span,
  .psge-sidebar__active-title,
  .psge-sidebar__active-desc,
  .psge-sidebar__hist-text,
  .psge-sidebar__show-all,
  .psge-sidebar__blurb p { display: none; }

  .psge-sidebar__active { margin: 4px 4px; padding: 8px; justify-content: center; }
  .psge-sidebar__active-icon { margin: 0; }
  .psge-sidebar__item { justify-content: center; padding: 9px 0; }
  .psge-sidebar__item svg { opacity: 1; }
  .psge-sidebar__blurb { padding: 8px; margin: 8px 4px; }
  .psge-sidebar__blurb-icon { margin: 0 auto; }

  .psge-topbar__title-sub { display: none; }
}

@media (max-width: 767px) {
  :root {
    --psge-bottom-h: 72px;
  }

  .psge-layout {
    grid-template-areas:
      "topbar"
      "canvas"
      "bottom";
    grid-template-columns: 1fr;
    grid-template-rows: var(--psge-topbar-h) 1fr var(--psge-bottom-h);
  }

  .psge-sidebar { display: none; }
  .psge-right   { display: none; }

  .psge-topbar__logo-name { display: none; }
  .psge-topbar__title-sub { display: none; }
  .psge-topbar__vdivider  { display: none; }

  .psge-intent-bar { min-width: calc(100% - 120px); }

  #psge-cy { display: none !important; }
  .psge-lista-view { display: block; padding-top: 60px; }
  .psge-canvas-wrap::before { display: none; }

  .psge-view-toggle { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CLUSTER COLOR UTILITIES
   ═══════════════════════════════════════════════════════════════════════════ */

.psge-color-cluster-primary { color: var(--cluster-primary); }
.psge-color-cluster-green   { color: var(--cluster-green); }
.psge-color-cluster-teal    { color: var(--cluster-teal); }
.psge-color-cluster-magenta { color: var(--cluster-magenta); }
.psge-color-cluster-purple  { color: var(--cluster-purple); }
.psge-color-cluster-orange  { color: var(--cluster-orange); }
.psge-color-cluster-blue    { color: var(--cluster-blue); }
.psge-color-cluster-yellow  { color: var(--cluster-yellow); }
.psge-color-cluster-pink    { color: var(--cluster-pink); }
.psge-color-cluster-rose    { color: var(--cluster-rose); }
.psge-color-cluster-amber   { color: var(--cluster-amber); }

.psge-bg-cluster-primary { background: rgba(139,92,246,0.15); }
.psge-bg-cluster-green   { background: rgba(34,197,94,0.15); }
.psge-bg-cluster-teal    { background: rgba(6,182,212,0.15); }
.psge-bg-cluster-magenta { background: rgba(236,72,153,0.15); }
.psge-bg-cluster-purple  { background: rgba(168,85,247,0.15); }
.psge-bg-cluster-orange  { background: rgba(249,115,22,0.15); }
.psge-bg-cluster-blue    { background: rgba(59,130,246,0.15); }
.psge-bg-cluster-yellow  { background: rgba(234,179,8,0.15); }

/* ==========================================================================
   PSGE Gateway polish overrides
   ========================================================================== */

:root {
  --psge-sidebar-w: 206px;
  --psge-right-w: 344px;
  --psge-topbar-h: 78px;
  --psge-bottom-h: 120px;
}

.psge-topbar {
  padding: 0 24px;
  background:
    linear-gradient(180deg, rgba(5, 7, 14, 0.98), rgba(7, 9, 18, 0.94));
}

.psge-topbar__logo,
.psge-topbar__vdivider {
  display: none;
}

.psge-topbar__context {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.psge-topbar__breadcrumb {
  font-size: 12px;
  letter-spacing: 0.04em;
}

.psge-topbar__title-wrap {
  border-radius: 16px;
  padding: 8px 16px;
  background: linear-gradient(180deg, rgba(90, 55, 180, 0.3), rgba(32, 22, 68, 0.58));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 12px 26px rgba(39, 19, 88, 0.2);
}

.psge-topbar__title-main {
  font-size: 14px;
}

.psge-topbar__title-sub {
  font-size: 11px;
}

.psge-btn--ghost {
  min-height: 44px;
  border-radius: 14px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.02);
}

.psge-topbar__avatar {
  width: 42px;
  height: 42px;
  font-size: 13px;
}

.psge-sidebar {
  padding: 18px 0 14px;
  background:
    linear-gradient(180deg, rgba(5, 7, 14, 0.98), rgba(8, 10, 19, 0.94));
}

.psge-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 20px 16px;
  text-decoration: none;
}

.psge-sidebar__brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(126, 90, 255, 0.18), rgba(41, 133, 255, 0.14));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.psge-sidebar__brand-logo img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.psge-sidebar__brand-word {
  color: #f8f8ff;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.psge-sidebar__connect-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 16px 14px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--psge-text-muted);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
}

.psge-sidebar__connect-link:hover {
  color: var(--psge-text);
  border-color: rgba(139, 92, 246, 0.22);
}

.psge-sidebar__active {
  margin: 8px 14px 10px;
  padding: 14px;
  border-radius: 16px;
  border-color: rgba(157, 112, 255, 0.45);
  box-shadow:
    0 0 0 1px rgba(139, 92, 246, 0.16),
    0 16px 36px rgba(39, 19, 88, 0.24);
}

.psge-sidebar__active-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
}

.psge-sidebar__hist-item {
  padding-top: 9px;
  padding-bottom: 9px;
}

.psge-sidebar__blurb {
  margin: 18px 14px 6px;
  padding: 16px 14px;
  gap: 12px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(21, 18, 41, 0.78), rgba(8, 12, 22, 0.92)),
    radial-gradient(circle at bottom left, rgba(59, 130, 246, 0.14), transparent 45%);
}

.psge-sidebar__blurb-copy {
  display: grid;
  gap: 6px;
}

.psge-sidebar__blurb-copy strong {
  color: #ede9fe;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.psge-sidebar__blurb-copy p {
  display: block;
  margin: 0;
}

.psge-canvas-wrap {
  padding: 16px 18px 0;
}

.psge-canvas-shell {
  position: relative;
  height: 100%;
}

.psge-canvas-wrap::before {
  inset: 0;
  border-radius: 28px;
}

#psge-stars,
#psge-cy,
.psge-canvas-loading {
  inset: 74px 10px 18px 10px;
  border-radius: 30px;
}

.psge-canvas-loading {
  background:
    linear-gradient(180deg, rgba(4, 7, 14, 0.92), rgba(5, 7, 13, 0.96));
  backdrop-filter: blur(8px);
}

.psge-intent-bar {
  top: 14px;
  max-width: calc(100% - 120px);
  min-height: 56px;
  padding: 0 20px;
  border-radius: 18px;
  background: rgba(10, 13, 24, 0.82);
  border-color: rgba(255, 255, 255, 0.09);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 18px 48px rgba(0, 0, 0, 0.3);
}

.psge-intent-bar__label {
  font-size: 13px;
  color: #b6b7c8;
  text-transform: none;
  letter-spacing: 0;
}

.psge-intent-bar__text {
  font-size: 17px;
  font-weight: 600;
}

.psge-central-orb {
  position: absolute;
  left: 50%;
  top: 56%;
  transform: translate(-50%, -50%);
  width: 264px;
  height: 264px;
  border-radius: 50%;
  z-index: 3;
  pointer-events: none;
  display: grid;
  place-items: center;
}

.psge-central-orb__halo,
.psge-central-orb__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.psge-central-orb__halo {
  background:
    radial-gradient(circle at 50% 50%, rgba(162, 104, 255, 0.34) 0%, rgba(99, 102, 241, 0.2) 34%, rgba(6, 10, 18, 0) 72%);
  filter: blur(10px);
}

.psge-central-orb__ring {
  inset: 9%;
  border: 1px solid rgba(177, 148, 255, 0.4);
  box-shadow:
    0 0 0 18px rgba(121, 74, 255, 0.08),
    0 0 42px rgba(119, 87, 255, 0.46),
    inset 0 0 28px rgba(255, 255, 255, 0.06);
}

.psge-central-orb__core {
  position: relative;
  width: 76%;
  height: 76%;
  border-radius: 50%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  text-align: center;
  padding: 34px 26px;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.12), transparent 26%),
    linear-gradient(180deg, rgba(28, 18, 55, 0.88), rgba(10, 16, 28, 0.94));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 24px 80px rgba(35, 23, 82, 0.4);
}

.psge-central-orb__icon {
  font-size: 42px;
  line-height: 1;
  text-shadow: 0 0 28px rgba(181, 155, 255, 0.45);
}

.psge-central-orb__title {
  color: #ffffff;
  font-size: 19px;
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.psge-central-orb__subtitle {
  color: #d4d7e6;
  font-size: 14px;
  line-height: 1.45;
  max-width: 18ch;
}

.psge-view-toggle {
  bottom: 26px;
  padding: 5px;
  border-radius: 18px;
}

.psge-view-toggle-btn {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 14px;
}

.psge-view-toggle-btn.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.66), rgba(99, 102, 241, 0.32));
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(72, 38, 173, 0.24);
}

.psge-zoom-controls {
  left: 28px;
  bottom: 68px;
  gap: 8px;
}

.psge-zoom-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
}

.psge-right {
  gap: 14px;
  padding: 18px 16px;
  background: transparent;
  border-left: none;
}

.psge-panel-section,
.psge-node-detail {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(13, 16, 28, 0.9), rgba(8, 11, 20, 0.92));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.psge-panel-section {
  padding: 18px 16px;
}

.psge-node-detail {
  padding: 16px;
}

.psge-panel-label {
  margin-bottom: 16px;
  color: #d0d4e3;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.psge-step-card,
.psge-partner-card {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

.psge-step-card:hover,
.psge-partner-card:hover {
  background: rgba(255, 255, 255, 0.03);
}

.psge-ai-insight {
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(39, 23, 84, 0.48), rgba(10, 14, 25, 0.95));
  border: 1px solid rgba(139, 92, 246, 0.16);
}

.psge-ai-insight__cta {
  min-height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.92), rgba(99, 102, 241, 0.82));
}

.psge-bottom {
  background: transparent;
  border-top: none;
  padding: 12px 18px 18px;
}

.psge-bottom__header {
  color: #d0d4e3;
}

.psge-timeline {
  border-radius: 22px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(12, 15, 27, 0.9), rgba(7, 10, 18, 0.94));
}

@media (max-width: 1024px) and (min-width: 768px) {
  .psge-sidebar__brand-word,
  .psge-sidebar__connect-link,
  .psge-sidebar__blurb-copy strong,
  .psge-sidebar__blurb-copy p {
    display: none;
  }

  .psge-sidebar__brand {
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
  }

  .psge-sidebar__connect-link {
    display: none;
  }
}

@media (max-width: 767px) {
  .psge-topbar {
    padding: 0 12px;
    gap: 10px;
  }

  .psge-topbar__context {
    gap: 10px;
  }

  .psge-canvas-wrap {
    padding: 8px 8px 0;
  }

  .psge-canvas-shell {
    height: 100%;
  }

  .psge-central-orb,
  .psge-zoom-controls {
    display: none;
  }

  #psge-stars,
  #psge-cy,
  .psge-canvas-loading {
    inset: 58px 0 0 0;
    border-radius: 0;
  }

  .psge-intent-bar {
    top: 10px;
    max-width: calc(100% - 18px);
  }
}
