/* ==========================================================================
   Prime Gestión — Estilos Módulo 01: Estrategia
   ========================================================================== */

/* Pizarra */
.piz-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
  min-height: 550px;
  background: #090909;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.piz-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  z-index: 20;
  gap: 10px;
  flex-wrap: wrap;
}

.piz-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: #080808;
  background-image: radial-gradient(#1e1e1e 1.5px, transparent 1.5px);
  background-size: 32px 32px;
  cursor: grab;
  user-select: none;
}
.piz-viewport.panning {
  cursor: grabbing;
}
.piz-viewport.connecting {
  cursor: crosshair;
}

.piz-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 4000px;
  height: 3000px;
  transform-origin: 0 0;
  pointer-events: none;
}

.piz-svg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 4000px;
  height: 3000px;
  pointer-events: auto;
  z-index: 5;
}

.piz-line-path {
  stroke: var(--accent);
  stroke-width: 2.5px;
  stroke-dasharray: 6 4;
  fill: none;
  transition: stroke .2s, stroke-width .2s;
}

.piz-line-hit {
  stroke: transparent;
  stroke-width: 20px;
  fill: none;
  cursor: pointer;
}

.piz-line-group:hover .piz-line-path {
  stroke: var(--red) !important;
  stroke-width: 3.5px !important;
  stroke-dasharray: none;
}

.piz-line-del-btn {
  opacity: 0;
  cursor: pointer;
  transition: opacity .2s;
}

.piz-line-group:hover .piz-line-del-btn {
  opacity: 1;
}

.piz-card {
  position: absolute;
  background: #15221e;
  border: 2px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
  cursor: move;
  pointer-events: auto;
  user-select: none;
  perspective: 1000px;
  transition: box-shadow .2s, border-color .2s;
  box-sizing: border-box;
  z-index: 10;
}

.piz-card.selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 191, 173, .4), 0 8px 24px rgba(0, 0, 0, .6);
}

.piz-card.connecting-source {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 4px rgba(235, 160, 50, .55), 0 0 20px rgba(235, 160, 50, .4) !important;
  animation: pizPulse 1.2s infinite alternate ease-in-out;
}

@keyframes pizPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.025); }
}

.piz-card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  z-index: 15;
  background: rgba(10, 15, 13, 0.85);
  border-radius: 6px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.piz-card-btn {
  background: transparent;
  border: none;
  color: #c0c0c0;
  font-size: 13px;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, transform .15s;
}

.piz-card-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  transform: scale(1.1);
}

.piz-card-btn.connect:hover {
  color: var(--accent);
}

.piz-card-btn.del:hover {
  color: var(--red);
  background: rgba(239, 68, 68, 0.2);
}

.piz-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .45s cubic-bezier(.22, .61, .36, 1);
}

.piz-card.flipped .piz-card-inner {
  transform: rotateY(180deg);
}

.piz-card-front, .piz-card-back {
  position: absolute;
  inset: 0;
  padding: 28px 14px 14px 14px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
}

.piz-card-front {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.piz-card-back {
  background: #111a17;
  transform: rotateY(180deg);
  overflow-y: auto;
}

.piz-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.35;
  word-break: break-word;
}

.piz-card-back .piz-card-title {
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(59, 191, 173, .2);
  padding-bottom: 4px;
}

.piz-card-body {
  font-size: 12px;
  color: #d0d0d0;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
}

.piz-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  background: var(--accent);
  cursor: nwse-resize;
  border-top-left-radius: 4px;
  border-bottom-right-radius: 8px;
  opacity: .7;
  pointer-events: auto;
  z-index: 15;
}
.piz-resize-handle:hover {
  opacity: 1;
}

.piz-att-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 11px;
  color: var(--gold);
  font-weight: 700;
  z-index: 15;
}

/* Chatbot layout */
.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  height: calc(100vh - 165px);
  min-height: 600px;
}
@media (max-width: 992px) {
  .chat-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.chat-pane {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-bubble {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 12px;
  line-height: 1.5;
  animation: fadeUp .25s var(--ease) both;
}

.chat-bubble.user {
  align-self: flex-end;
  background: #1b2e29;
  border: 1px solid rgba(59, 191, 173, .35);
  color: #ffffff;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: #161616;
  border: 1px solid var(--border);
  color: #e0e0e0;
}

.chat-sources-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.chat-report-pane {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
