/* GuayaIA · Conexión en Vivo AGI + Multi-Imagen + Consola en Tiempo Real + Reporte */
.agi-live-root {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #16362b;
}

.agi-live-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid #d4e3dc;
  background: #f5faf7;
}

.agi-live-status-bar.is-online {
  background: #ecfdf5;
  border-color: #86efac;
}

.agi-live-status-bar.is-busy {
  background: #eff6ff;
  border-color: #93c5fd;
}

.agi-live-status-bar.is-offline {
  background: #fff7ed;
  border-color: #fdba74;
}

.agi-live-status-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.agi-live-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #94a3b8;
  flex-shrink: 0;
}

.agi-live-status-bar.is-online .agi-live-dot {
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.agi-live-status-bar.is-busy .agi-live-dot {
  background: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
  animation: agiPulse 1.4s infinite;
}

.agi-live-status-bar.is-offline .agi-live-dot {
  background: #ea580c;
  box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.16);
}

@keyframes agiPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.22); opacity: 0.7; }
}

.agi-live-status-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.agi-live-status-title {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  color: #0f291e;
}

.agi-live-status-meta {
  font-size: 10.5px;
  color: #516b60;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agi-live-auth-btn {
  border: 1px solid #087a55;
  background: #087a55;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
}
.agi-live-auth-btn:hover { background: #066344; }
.agi-live-auth-btn.is-secondary {
  background: #fff;
  color: #087a55;
}

.agi-live-card {
  background: #ffffff;
  border: 1px solid #d4e3dc;
  border-radius: 13px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agi-live-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 800;
  color: #123d2f;
}

.agi-live-count-pill {
  background: #eaf5ef;
  color: #087a55;
  border: 1px solid #bfe3d1;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 800;
}

/* Multi-Image Dropzone & Grid */
.agi-dropzone {
  border: 1.5px dashed #8bc4ab;
  background: #f6fbf8;
  border-radius: 11px;
  padding: 10px;
  text-align: center;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
}

.agi-dropzone.is-dragover {
  border-color: #087a55;
  background: #dff5ea;
  transform: scale(0.995);
}

.agi-dropzone-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.agi-mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #c9ddd3;
  background: #fff;
  color: #123d2f;
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.agi-mini-btn:hover { background: #eaf5ef; border-color: #087a55; }
.agi-mini-btn.is-primary {
  background: #087a55;
  border-color: #087a55;
  color: #fff;
}
.agi-mini-btn.is-primary:hover { background: #066344; }
.agi-mini-btn.is-warn {
  background: #fff7ed;
  border-color: #fb923c;
  color: #9a3412;
}
.agi-mini-btn.is-warn:hover { background: #ffedd5; }
.agi-mini-btn.is-danger {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.agi-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 7px;
  max-height: 210px;
  overflow-y: auto;
  padding: 2px;
}

.agi-photo-card {
  position: relative;
  border: 1px solid #d4e3dc;
  border-radius: 9px;
  overflow: hidden;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
}

.agi-photo-card img {
  width: 100%;
  height: 58px;
  object-fit: cover;
  display: block;
}

.agi-photo-role {
  border: none;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  color: #16362b;
  font-size: 9.5px;
  font-weight: 700;
  padding: 3px 4px;
  width: 100%;
  cursor: pointer;
}

.agi-photo-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.agi-photo-del:hover { background: #dc2626; }

.agi-photo-idx {
  position: absolute;
  top: 3px;
  left: 3px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(8, 122, 85, 0.88);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}

/* Rules Pills */
.agi-rules-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.agi-rule-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 9px;
  border: 1px solid #d4e3dc;
  background: #f8faf9;
  color: #365246;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: all 0.14s ease;
}
.agi-rule-chip input { display: none; }
.agi-rule-chip.is-active {
  background: #eaf5ef;
  border-color: #087a55;
  color: #087a55;
}

/* Prompt & Action */
.agi-prompt-box {
  width: 100%;
  min-height: 62px;
  max-height: 140px;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid #cbd9d2;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.4;
  color: #0f291e;
  background: #fff;
}
.agi-prompt-box:focus {
  outline: none;
  border-color: #087a55;
  box-shadow: 0 0 0 3px rgba(8, 122, 85, 0.12);
}

.agi-launch-btn {
  width: 100%;
  border: none;
  border-radius: 11px;
  padding: 11px 14px;
  font-size: 12.5px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #087a55 0%, #0b9668 100%);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 6px 16px rgba(8, 122, 85, 0.22);
  transition: transform 0.14s ease, opacity 0.14s ease;
}
.agi-launch-btn:hover:not(:disabled) { transform: translateY(-1px); }
.agi-launch-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Real-time Console */
.agi-console-card {
  background: #0d1714;
  color: #d8eee4;
  border: 1px solid #1f3b31;
  border-radius: 13px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.agi-console-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.agi-console-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 800;
  color: #6ee7b7;
}

.agi-console-timer {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  color: #93c5b2;
}

.agi-progress-track {
  width: 100%;
  height: 6px;
  background: #1a2d26;
  border-radius: 999px;
  overflow: hidden;
}

.agi-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981, #34d399);
  transition: width 0.25s ease;
}

.agi-progress-fill.is-error {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.agi-phase-desc {
  font-size: 11px;
  color: #bbf7d0;
  line-height: 1.3;
}

.agi-console-alert {
  background: rgba(234, 88, 12, 0.16);
  border: 1px solid rgba(251, 146, 60, 0.55);
  color: #fed7aa;
  border-radius: 9px;
  padding: 7px 9px;
  font-size: 11px;
  line-height: 1.35;
}
.agi-console-alert.is-error {
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(248, 113, 113, 0.65);
  color: #fecaca;
}

.agi-console-log {
  background: #070e0c;
  border: 1px solid #193129;
  border-radius: 9px;
  padding: 8px;
  max-height: 220px;
  min-height: 105px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.agi-log-line {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 6px;
  align-items: start;
  word-break: break-word;
}

.agi-log-time { color: #64748b; white-space: nowrap; }
.agi-log-tag {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.agi-log-tag.is-info { background: #1e293b; color: #93c5fd; }
.agi-log-tag.is-tool { background: #164e63; color: #67e8f9; }
.agi-log-tag.is-thought { background: #14532d; color: #86efac; }
.agi-log-tag.is-complete { background: #065f46; color: #6ee7b7; }
.agi-log-tag.is-error { background: #7f1d1d; color: #fca5a5; }
.agi-log-tag.is-warn { background: #7c2d12; color: #fdba74; }

.agi-log-msg { color: #e2e8f0; }
.agi-log-detail { display: block; color: #94a3b8; font-size: 10px; margin-top: 1px; }

.agi-console-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
}

.agi-console-btn {
  border: 1px solid #2b4f41;
  background: #142821;
  color: #d1fae5;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.agi-console-btn:hover { background: #1d3a30; }
.agi-console-btn.is-report {
  border-color: #f97316;
  background: #7c2d12;
  color: #ffedd5;
}
.agi-console-btn.is-report:hover { background: #9a3412; }
.agi-console-btn.is-vsm {
  border-color: #10b981;
  background: #065f46;
  color: #ecfdf5;
}
.agi-console-btn.is-cancel {
  border-color: #ef4444;
  background: #7f1d1d;
  color: #fee2e2;
}

/* Inline Report Drawer inside Console */
.agi-report-inline {
  background: #13221d;
  border: 1px solid #f97316;
  border-radius: 10px;
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.agi-report-inline textarea {
  width: 100%;
  min-height: 54px;
  border-radius: 8px;
  border: 1px solid #335547;
  background: #08110e;
  color: #f8fafc;
  padding: 7px;
  font-family: inherit;
  font-size: 11.5px;
}

.agi-report-inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 10.5px;
  color: #cbd5e1;
}

.agi-deliverable-box {
  background: #0b291f;
  border: 1px solid #10b981;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.agi-deliverable-title {
  font-size: 11.5px;
  font-weight: 800;
  color: #6ee7b7;
}
.agi-deliverable-summary {
  font-size: 11px;
  color: #d1fae5;
  white-space: pre-wrap;
  max-height: 90px;
  overflow-y: auto;
  line-height: 1.38;
}

.agi-history-strip {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 135px;
  overflow-y: auto;
}
.agi-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #d4e3dc;
  background: #f8faf9;
  font-size: 11px;
  cursor: pointer;
}
.agi-history-item:hover { border-color: #087a55; background: #eaf5ef; }
.agi-history-item.is-selected { border-color: #087a55; background: #dcfce7; }
