.kanban-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: calc(100vh - 4rem);
  overflow: hidden;
  padding: 1rem;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .kanban-wrapper {
    padding: 0.5rem;
  }
}

.kanban-toolbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  /* Allow wrapping on small screens */
}

.workflow-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.workflow-selector label {
  font-weight: 600;
  color: #374151;
}

.workflow-selector select {
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  min-width: 200px;
}

.btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn.secondary {
  background: #475569;
}

.btn.xs {
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
}

.debug-info {
  padding: 0.5rem;
  background: #f0f9ff;
  border-radius: 4px;
  color: #0369a1;
  font-size: 0.75rem;
}

.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 1rem;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.workflows-list {
  flex: 1;
  overflow-y: auto;
}

.workflows-list h3 {
  margin: 0 0 1rem 0;
  color: #374151;
}

.workflow-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.workflow-card {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.workflow-card:hover {
  border-color: #2563eb;
}

.workflow-card h4 {
  margin: 0 0 0.5rem 0;
  color: #111827;
}

.workflow-card p {
  margin: 0 0 1rem 0;
  color: #6b7280;
  font-size: 0.875rem;
}

.workflow-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.column-tag {
  background: #f3f4f6;
  color: #374151;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.selected-workflow-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 8px;
}

.selected-workflow-info h3 {
  margin: 0;
  color: #111827;
}

.selected-workflow-info p {
  margin: 0;
  color: #374151;
  font-size: 0.875rem;
}

.kanban-scroll {
  display: flex;
  gap: 1rem;
  width: 100%;
  flex: 1;
  min-height: 0;
  padding-bottom: 0.5rem;
  overflow-x: auto;
  align-items: stretch;
}

.kanban-column {
  background: #f1f5f9;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-width: 290px;
  max-width: 360px;
  flex: 1 1 0;
  padding: 0.65rem;
  box-sizing: border-box;
}

.cards-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}

.draggable-area {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.no-cards {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  pointer-events: none;
  z-index: 0;
}

.no-cards p {
  margin: 0 0 0.5rem 0;
  font-weight: 500;
}

.no-cards small {
  color: #9ca3af;
}

.no-workflow {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  color: #6b7280;
}

.no-workflow p {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
}

.fancy-card {
  min-height: auto;
  /* Allow auto height */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(60, 60, 100, 0.08);
  padding: 1rem;
  /* Slightly reduced padding for mobile */
  transition: box-shadow 0.2s;
  border: 1px solid #e5e7eb;
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  /* Prevent squashing */
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  /* Align to top in case of wrapping */
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.card-title {
  font-weight: 600;
  color: #2563eb;
  font-size: 1rem;
  word-break: break-word;
  /* Ensure long words don't overflow */
}

.card-estado {
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: #e0e7ff;
  color: #3730a3;
  font-weight: 500;
  flex-shrink: 0;
  /* Don't shrink badge */
  white-space: nowrap;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.card-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  /* Align top for wrapped text */
  flex-wrap: nowrap;
  width: 100%;
}

.card-label {
  font-weight: 500;
  color: #475569;
  min-width: 100px;
  /* Slightly reduce min-width */
  font-size: 0.92rem;
  flex-shrink: 0;
}

.card-value {
  color: #334155;
  font-size: 0.92rem;
  flex: 1;
  min-width: 0;
  text-align: left;
  white-space: normal;
  /* Allow wrapping */
  word-break: break-word;
  /* Break long words */
  overflow: visible;
  /* Show all content */
}

.card-footer {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f3f4f6;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  min-width: 250px;
  font-size: 0.9rem;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.clear-search {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 20px;
  height: 20px;
}

.clear-search:hover {
  color: #ef4444;
  background-color: #fce7f3;
}

@keyframes highlight-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
        border-color: #2563eb;
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
        border-color: #2563eb;
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
        border-color: #e5e7eb;
        transform: scale(1);
    }
}

.highlight-card {
    animation: highlight-pulse 2s ease-out infinite;
    z-index: 10;
    position: relative;
}
